question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

loadUserProfile() : Error performing password flow TypeError: Cannot read property 'toLowerCase' of null

See original GitHub issue

Hi,

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:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
LeoPotecommented, Apr 15, 2020

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.

3reactions
FarhatWcommented, Apr 13, 2018

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 }

}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'toLowerCase' of null - Bountysource
loadUserProfile () : Error performing password flow TypeError: Cannot read property 'toLowerCase' of null.
Read more >
Filter doesn't work: Error Cannot read property 'toLowerCase ...
if you are receiving a "TypeError: Cannot read property 'toLowerCase' of null" error, this means that the value that you are performing the ......
Read more >
OAuthService - angular-oauth2-oidc
Uses password flow to exchange userName and password for an access_token. ... with OAuth2 password flow, make sure that the property oidc is...
Read more >
angular-oauth2-oidc - UNPKG
hasValidAccessToken()) {\r\n throw new Error('Can not load User Profile ... n' +\r\n 'if you are not using oidc but just oauth2 password flow...
Read more >
Building hybrid mobile apps using Ionic 2 and Firebase
The purpose of this post is to build an hybrid mobile app using Ionic 2, Angular 2 and Firebase. Yes, you 've just...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found