Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
🐛 Fixes overwriting scopes (#32)
Browse files Browse the repository at this point in the history
Resolves: OKTA-146916
  • Loading branch information
jmelberg-okta authored Oct 31, 2017
1 parent d7f4d9b commit ec81340
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/okta-angular/src/okta/okta.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class OktaAuthService {
/**
* Scrub scopes to ensure 'openid' is included
*/
auth.scopes = this.scrubScopes(auth.scopes);
auth.scope = this.scrubScopes(auth.scope);

/**
* Cache the auth config.
Expand Down Expand Up @@ -101,7 +101,8 @@ export class OktaAuthService {
loginRedirect(additionalParams?: object) {
this.oktaAuth.token.getWithRedirect({
responseType: ['id_token', 'token'],
scope: this.config.scope,
// Convert scopes to list of strings
scopes: this.config.scope.split(' '),
...additionalParams
});
}
Expand Down Expand Up @@ -162,8 +163,9 @@ export class OktaAuthService {
// Make sure object is a string
scopes = Array.isArray(scopes) ? scopes.join(' ') : scopes
}
if (scopes.indexOf('openid') !== -1) {
if (scopes.indexOf('openid') === -1) {
return scopes + ' openid';
}
return scopes;
}
}
2 changes: 1 addition & 1 deletion packages/okta-angular/test/e2e/harness/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"@okta/okta-angular": "file:../../../okta-okta-angular-0.0.4.tgz",
"@okta/okta-angular": "file:../../../okta-okta-angular-0.0.8.tgz",
"core-js": "^2.4.1",
"ejs": "^2.5.6",
"rxjs": "^5.4.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const config = {
issuer: environment.ISSUER,
redirectUri: environment.REDIRECT_URI,
clientId: environment.CLIENT_ID,
scope: 'email',
onAuthRequired: onNeedsGlobalAuthenticationGuard
};

Expand Down

0 comments on commit ec81340

Please sign in to comment.