Skip to content

Cannot read property 'split' of undefined ... OAuthService.storeAccessTokenResponse #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AlQuraian opened this issue May 14, 2018 · 8 comments

Comments

@AlQuraian
Copy link

Hi,

Thanks a lot for the update to support Angular 6. However, after updating I get this error when I try to login:

ERROR TypeError: Cannot read property 'split' of undefined
    at OAuthService.push../node_modules/angular-oauth2-oidc/esm5/angular-oauth2-oidc.js.OAuthService.storeAccessTokenResponse (angular-oauth2-oidc.js:1039)
    at SafeSubscriber._next (angular-oauth2-oidc.js:625)
    at 

Here's my config:

export const authConfig: AuthConfig = {
  issuer: 'http://localhost:5000',
  clientId: 'ngclient',
  dummyClientSecret: 'secret',
  scope: 'openid profile roles webApi offline_access',
  showDebugInformation: true,
  oidc: false
};

My token endpoint is only returning:

{
  access_token: 'eyJhbGciOiJSUz.....',
  expires_in : 3600,
  refresh_token: 'd4f06feb10391....',
  token_type : "Bearer"
}

Am I doing something wrong?

@AmirFransis
Copy link

AmirFransis commented May 15, 2018

after update to ver 4 im getting the same error,
under storeAccessTokenResponse function, its trying to split grantedScopes object which is null.

@xmlking
Copy link

xmlking commented May 15, 2018

grantedScopes is undefined for me. so i am getting same error.

@bechhansen
Copy link
Contributor

I have also seen this problem. The problems is already fixed in the https://www.npmjs.com/package/angular-oauth2-oidc-codeflow fork.

@abentabet
Copy link

I have the same problem after update to ver 4, is there any quick workaround ?

@razzeee
Copy link
Contributor

razzeee commented May 15, 2018

The PR causing this seems to be #274

@mevogt
Copy link

mevogt commented May 15, 2018

Quick workaround; call tryLogin() with customHashFragment; e.g.:

let customHashFragment = window.location.hash + '&scope=read+write'; this.oauthService.tryLogin({customHashFragment: customHashFragment});

@manfredsteyer
Copy link
Owner

Will look into this quickly

manfredsteyer added a commit that referenced this issue May 15, 2018
@manfredsteyer
Copy link
Owner

Thanks for pointing this out and the PR. I've just published a new version 4.0.1 with a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants