Skip to content

Commit fd34f17

Browse files
committed
issue #309
1 parent 8d40130 commit fd34f17

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ Successfully tested with **Angular 6** and its Router, PathLocationStrategy as w
3838

3939
# Features
4040
- Logging in via OAuth2 and OpenId Connect (OIDC) Implicit Flow (where user is redirected to Identity Provider)
41-
- "Logging in" via Password Flow (where user enters his/her password into the client)
41+
- "Logging in" via Password Flow (where user enters their password into the client)
4242
- Token Refresh for Password Flow by using a Refresh Token
43-
- Automatically refreshing a token when/ some time before it expires
43+
- Automatically refreshing a token when/some time before it expires
4444
- Querying Userinfo Endpoint
4545
- Querying Discovery Document to ease configuration
4646
- Validating claims of the id_token regarding the specs
@@ -49,7 +49,7 @@ Successfully tested with **Angular 6** and its Router, PathLocationStrategy as w
4949

5050
## Sample-Auth-Server
5151

52-
You can use the OIDC-Sample-Server mentioned in the samples for Testing. It assumes, that your Web-App runns on http://localhost:8080.
52+
You can use the OIDC-Sample-Server mentioned in the samples for Testing. It assumes, that your Web-App runs on http://localhost:8080.
5353

5454
Username/Password: max/geheim
5555

@@ -101,7 +101,7 @@ Single Page Application. It sends the user to the Identity Provider's login page
101101
This also allows for single sign on as well as single sign off.
102102

103103
To configure the library the following sample uses the new configuration API introduced with Version 2.1.
104-
Hence, The original API is still supported.
104+
Hence, the original API is still supported.
105105

106106
```TypeScript
107107
import { AuthConfig } from 'angular-oauth2-oidc';
@@ -206,7 +206,7 @@ The following snippet contains the template for the login page:
206206

207207
### Skipping the Login Form
208208

209-
If you don't want to display a login form that tells the user that they are redirected to the identity server, you can use the convenince function ``this.oauthService.loadDiscoveryDocumentAndLogin();`` instead of ``this.oauthService.loadDiscoveryDocumentAndTryLogin();`` when setting up the library.
209+
If you don't want to display a login form that tells the user that they are redirected to the identity server, you can use the convenience function ``this.oauthService.loadDiscoveryDocumentAndLogin();`` instead of ``this.oauthService.loadDiscoveryDocumentAndTryLogin();`` when setting up the library.
210210

211211
This directly redirects the user to the identity server if there are no valid tokens.
212212

projects/lib/src/oauth-service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export class OAuthService extends AuthConfig {
249249
return;
250250
}
251251

252-
if (this.hasValidIdToken) {
252+
if (this.hasValidIdToken()) {
253253
this.clearAccessTokenTimer();
254254
this.clearIdTokenTimer();
255255
this.setupExpirationTimers();
@@ -803,7 +803,7 @@ export class OAuthService extends AuthConfig {
803803
public silentRefresh(params: object = {}, noPrompt = true): Promise<OAuthEvent> {
804804
const claims: object = this.getIdentityClaims() || {};
805805

806-
if (this.useIdTokenHintForSilentRefresh && this.hasValidIdToken) {
806+
if (this.useIdTokenHintForSilentRefresh && this.hasValidIdToken()) {
807807
params['id_token_hint'] = this.getIdToken();
808808
}
809809

@@ -1573,7 +1573,9 @@ export class OAuthService extends AuthConfig {
15731573
* Returns the current id_token.
15741574
*/
15751575
public getIdToken(): string {
1576-
return this._storage.getItem('id_token');
1576+
return this._storage ?
1577+
this._storage.getItem('id_token') :
1578+
null;
15771579
}
15781580

15791581
private padBase64(base64data): string {

0 commit comments

Comments
 (0)