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

Fixed two issues when responseType is id_token only: #18

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/okta-angular/src/okta/okta.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export class OktaAuthService {
}

/**
* Checks if there is a current accessToken in the TokenManager.
* Checks if there is a current accessToken or idToken in the TokenManager.
*/
isAuthenticated() {
return !!this.oktaAuth.tokenManager.get('accessToken');
return !!this.oktaAuth.tokenManager.get('accessToken') || !!this.oktaAuth.tokenManager.get('idToken');
}

/**
Expand Down Expand Up @@ -114,7 +114,8 @@ export class OktaAuthService {
* Parses the tokens from the callback URL.
*/
async handleAuthentication() {
const tokens = await this.oktaAuth.token.parseFromUrl();
let tokens = await this.oktaAuth.token.parseFromUrl();
tokens = Object.prototype.toString.call(tokens) === '[object Array]' ? tokens : [tokens];
tokens.forEach(token => {
if (token.idToken) {
this.oktaAuth.tokenManager.add('idToken', token);
Expand Down