Skip to content

Commit

Permalink
fix: Correctly read the oauth strategy config (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
KidkArolis authored and daffl committed May 14, 2019
1 parent dd519f6 commit 9abf314
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/authentication-oauth/src/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ export interface OAuthProfile {

export class OAuthStrategy extends AuthenticationBaseStrategy {
get configuration () {
const { entity, service, entityId } = this.authentication.configuration;
const { entity, service, entityId, oauth } = this.authentication.configuration;
const config = oauth[this.name];

return {
entity,
service,
entityId,
...super.configuration
...config
};
}

Expand Down
6 changes: 6 additions & 0 deletions packages/authentication-oauth/test/strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ describe('@feathersjs/authentication-oauth/strategy', () => {
assert.ok(strategy.configuration.entity);
});

it('reads configuration from the oauth key', () => {
const testConfigValue = Math.random()
app.get('authentication').oauth.test.hello = testConfigValue
assert.strictEqual(strategy.configuration.hello, testConfigValue)
});

it('getRedirect', async () => {
app.get('authentication').oauth.redirect = '/home';

Expand Down

0 comments on commit 9abf314

Please sign in to comment.