Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// URL of the SPA to redirect the user after silent refresh
this.oauthService.silentRefreshRedirectUri =
window.location.origin + '/silent-refresh.html';
// The SPA's id. The SPA is registerd with this id at the auth-server
this.oauthService.clientId = 'spa-demo';
// set the scope for the permissions the client should request
// The first three are defined by OIDC. The 4th is a usecase-specific one
this.oauthService.scope = 'openid profile email voucher';
// Url of the Identity Provider
this.oauthService.issuer =
'https://steyer-identity-server.azurewebsites.net/identity';
this.oauthService.tokenValidationHandler = new NullValidationHandler();
this.oauthService.events.subscribe(e => {
// tslint:disable-next-line:no-console
console.debug('oauth/oidc event', e);
});
// Load Discovery Document and then try to login the user
this.oauthService.loadDiscoveryDocument().then(doc => {
this.oauthService.tryLogin();
});
this.oauthService.events
.pipe(filter(e => e.type === 'token_expires'))
.subscribe(e => {
// tslint:disable-next-line:no-console
console.debug('received token_expires event', e);
private configureWithoutDiscovery() {
this.oauthService.configure(noDiscoveryAuthConfig);
this.oauthService.tokenValidationHandler = new NullValidationHandler();
this.oauthService.tryLogin();
}
constructor(
private oauthService: OAuthService,
private router: Router
) {
this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new NullValidationHandler();
this.oauthService.events
.subscribe(_ => {
this.isAuthenticatedSubject$.next(this.oauthService.hasValidAccessToken());
});
this.oauthService.setupAutomaticSilentRefresh();
}