I'm currently trying to implement azure ad authentication in my angular application. Unfortunately i'm running into some issues. The following code gives me the access token as i'm expecting. To implement it in my api I wanna use OpenIDConnect.
export class AppComponent implements OnInit {
title = 'Sign in test';
constructor(private oauthService: OAuthService) {
}
private async ConfigureAuth(): Promise<void> {
this.oauthService.configure({
loginUrl: 'loginUrl',
clientId: 'clientId',
resource: 'resource',
logoutUrl: 'logoutUrl',
redirectUri: window.location.origin + '/',
scope: 'openid',
oidc: false
});
this.oauthService.setStorage(sessionStorage);
}
async ngOnInit() {
await this.ConfigureAuth();
this.oauthService.tryLogin({});
if(!this.oauthService.getAccessToken()) {
await this.oauthService.initImplicitFlow();
}
console.log(this.oauthService.getAccessToken());
}
}
The sign in still works as it gives me the access token but when i set oidc
to true
it gives me the following errors:
angular-oauth2-oidc.js:1146 Error validating tokens
(anonymous) @ angular-oauth2-oidc.js:1146
Wrong issuer: https://sts.windows.net/{tenantid}/
ERROR Error: Uncaught (in promise): Wrong issuer: https://sts.windows.net/{tenantid}/
I'm not sure how to solve this issue, as the issuer in this case has the correct tenant ID.
Hope someone can help me out with this.