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.

Angular 7 Upgrade

See original GitHub issue

Hello,

After upgrade to Angular 7 I´m seeing a very strange behavior.

Before, the auth server was sending the REDIRECTURL#AccessToken=. When the app was loading, the access tokes was being removed from the URL and the login finalized. And I had the old URL back.

Now, after the login, My Url keeps this way Example: (replaced real information with ???)

http://localhost:4200/home#access_token=???&code=???&state=???&token_type=Bearer&expires_in=7199

Im using Implicit flow.

This is my configuration

  this.oauthService.configure(authConfig.authenticationConfig);
     this.oauthService.oidc = true;
     this.oauthService.setStorage(localStorage);
     this.oauthService.tokenValidationHandler = new JwksValidationHandler();
     console.log('before load');
     this.oauthService.loadDiscoveryDocument().then(() => {
       this.oauthService.tryLogin().then(() => {
        console.log(this.oauthService.getAccessToken());
        console.log(this.oauthService.getIdToken());
        }
     }

Look at Output console. I can see the library loading the access token with the “tryLogin”, but when I request using getAccessToken, it is null.

image

This is my routing config

{ path: 'home', component: HomeComponent },
 { path: '', redirectTo: 'home', pathMatch: 'full' },
 { path: '**', redirectTo: 'home' }

I Really appreciate any help in this case!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:21

github_iconTop GitHub Comments

4reactions
svw88commented, Dec 15, 2018

Hi @kzettlmeier, @prmces In your initial routing module add this to stop the url hash from being cleared before the idtoken is processed

RouterModule.forRoot(appRoutes, { initialNavigation: false }as ExtraOptions)

4reactions
kzettlmeiercommented, Nov 15, 2018

We are having the same type of issue after the Angular 7 upgrade. We are finding that the access token and id token are not getting stored and are returning null. We see the hash fragment in the URL and then it dissappears as if its getting pulled down and stored but afterward we are not able to grab. Previously we were using 4.0.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Update Guide
Select the options that match your update · Angular versions · Application complexity · Other dependencies.
Read more >
Keeping your Angular projects up-to-date
The Angular Update Guide provides customized update instructions, based on the current and target versions that you specify. It includes basic and advanced ......
Read more >
Upgrade to Angular 7 — Within 10 Minutes - Jeroen Ouwehand
This quick post will tell you how you can upgrade your Angular 6 project within 10 minutes to the new Angular 7 (at...
Read more >
How to upgrade Angular 7 to Angular 14 - YouTube
How to upgrade Angular 7 to Angular 13https://github.com/AmitXShukla/Visitor-Management-AppYoutube playlist ...
Read more >
How to Upgrade Angular 7 to Angular 13 - Stack Overflow
You go step by step, as the documentation tells you. You can add a --force to the upgrade command. Then it will ignore...
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