Skip to content

Commit

Permalink
fix: #687
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Mar 23, 2020
1 parent 4bf8901 commit e2599e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# angular-oauth2-oidc

Support for OAuth 2 and OpenId Connect (OIDC) in Angular.
Support for OAuth 2 and OpenId Connect (OIDC) in Angular. Already prepared for the upcoming OAuth 2.1.

![OIDC Certified Logo](https://raw.githubusercontent.com/manfredsteyer/angular-oauth2-oidc/master/oidc.png)

Expand Down Expand Up @@ -43,7 +43,7 @@ Please note, that this dependency is not needed for the **code flow**, which is

Successfully tested with **Angular 9** and its Router, PathLocationStrategy as well as HashLocationStrategy and CommonJS-Bundling via webpack. At server side we've used IdentityServer (.NET / .NET Core) and Redhat's Keycloak (Java).

**Angular 9**: Use 9.x versions of this library.
**Angular 9**: Use 9.x versions of this library (should also work with older Angular versions!).

**Angular 8**: Use 8.x versions of this library.

Expand Down Expand Up @@ -84,6 +84,7 @@ Successfully tested with **Angular 9** and its Router, PathLocationStrategy as w
- Validating claims of the id_token regarding the specs
- Hook for further custom validations
- Single-Sign-Out by redirecting to the auth-server's logout-endpoint
- Tested with all modern browsers and IE

## Sample-Auth-Server

Expand Down
7 changes: 5 additions & 2 deletions projects/lib/src/oauth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
}
}

protected checkSession(): void {
public checkSession(): void {
const iframe: any = document.getElementById(this.sessionCheckIFrameName);

if (!iframe) {
Expand Down Expand Up @@ -1440,9 +1440,12 @@ export class OAuthService extends AuthConfig implements OnDestroy {
customParameters?: Map<string, string>
): void {
this._storage.setItem('access_token', accessToken);
if (grantedScopes) {
if (grantedScopes && !Array.isArray(grantedScopes)) {
this._storage.setItem('granted_scopes', JSON.stringify(grantedScopes.split('+')));
} else if (grantedScopes && Array.isArray(grantedScopes)) {
this._storage.setItem('granted_scopes', JSON.stringify(grantedScopes));
}

this._storage.setItem('access_token_stored_at', '' + Date.now());
if (expiresIn) {
const expiresInMilliSeconds = expiresIn * 1000;
Expand Down

0 comments on commit e2599e0

Please sign in to comment.