Skip to content

Commit 9798cae

Browse files
Add initial changes for Code+PKCE flow
1 parent e536a89 commit 9798cae

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/app/app.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { AuthService } from './core/auth.service';
3333
<tr><th>IsDoneLoading</th><td><code>{{isDoneLoading | async}}</code></td></tr>
3434
<tr><th>CanActivateProtectedRoutes</th><td><code>{{canActivateProtectedRoutes | async}}</code></td></tr>
3535
<tr><th>IdentityClaims</th><td class="pre"><code>{{identityClaims | json}}</code></td></tr>
36+
<tr><th>RefreshToken</th><td><code class="break-all">{{refreshToken}}</code></td></tr>
3637
<tr><th>AccessToken</th><td><code class="break-all">{{accessToken}}</code></td></tr>
3738
<tr><th>IdToken</th><td><code class="break-all">{{idToken}}</code></td></tr>
3839
</table>
@@ -66,6 +67,7 @@ export class AppComponent {
6667

6768
get hasValidToken() { return this.authService.hasValidToken(); }
6869
get accessToken() { return this.authService.accessToken; }
70+
get refreshToken() { return this.authService.refreshToken; }
6971
get identityClaims() { return this.authService.identityClaims; }
7072
get idToken() { return this.authService.idToken; }
7173
}

src/app/core/auth-config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { AuthConfig } from 'angular-oauth2-oidc';
22

33
export const authConfig: AuthConfig = {
44
issuer: 'https://demo.identityserver.io',
5-
clientId: 'implicit',
5+
clientId: 'spa', // The "Auth Code + PKCE" client
6+
responseType: 'code',
67
redirectUri: window.location.origin + '/index.html',
78
silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html',
8-
scope: 'openid profile email api',
9+
scope: 'openid profile email offline_access api',
910
silentRefreshTimeout: 5000, // For faster testing
1011
timeoutFactor: 0.25, // For faster testing
1112
sessionChecksEnabled: true,

src/app/core/auth.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export class AuthService {
168168
// These normally won't be exposed from a service like this, but
169169
// for debugging it makes sense.
170170
public get accessToken() { return this.oauthService.getAccessToken(); }
171+
public get refreshToken() { return this.oauthService.getRefreshToken(); }
171172
public get identityClaims() { return this.oauthService.getIdentityClaims(); }
172173
public get idToken() { return this.oauthService.getIdToken(); }
173174
public get logoutUrl() { return this.oauthService.logoutUrl; }

0 commit comments

Comments
 (0)