loadUserProfile() : Error performing password flow TypeError: Cannot read property 'toLowerCase' of null
See original GitHub issueHi,
I want to get user profile, so i used it like this :
const user = this.oauthService.loadUserProfile()
console.log(user, user
);
My conf : export const authConfig: AuthConfig = {
clientId : ‘vegaJs’, redirectUri : ‘http://localhost:5002/#/dashboard?’, responseType : ‘id_token token’, scope : ‘openid profile vega’, postLogoutRedirectUri : ‘http://localhost:5002/’, issuer: ‘http://localhost:5000’,
}
LoginAuthComponent :
claims: any; constructor(private oauthService: OAuthService) {
// URL of the SPA to redirect the user to after login
this.configureWithNewConfigApi();
}
private configureWithNewConfigApi() { this.oauthService.configure(authConfig); this.oauthService.oidc = true; this.oauthService.setStorage(sessionStorage); this.oauthService.tokenValidationHandler = new JwksValidationHandler(); this.oauthService.loadDiscoveryDocument().then(() => { this.oauthService.tryLogin({}); }); }
public login() { this.oauthService.initImplicitFlow(); }
public logoff() { this.oauthService.logOut(); }
public getInfo() {
const user = this.oauthService.loadUserProfile()
console.log(user, user
);
}
when i call get info, I have Error performing password flow TypeError: Cannot read property ‘toLowerCase’ of null
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:13 (1 by maintainers)
Top GitHub Comments
Hello,
I am facing quite the same error calling “this.oAuthService.revokeTokenAndLogout()” for logout.
“angular-oauth2-oidc.js:2374 Error revoking token TypeError: Cannot read property ‘toLowerCase’ of undefined”
Any solution on this?
Tks.
try to call it into this
this.oauthService.loadDiscoveryDocument().then(() => { this.oauthService.tryLogin().then(() => { test if you have a valid token else call your code }
}