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.

Hash not being cleared after silent refresh in Firefox

See original GitHub issue

In Firefox, when the token is refreshed by silent refresh, it adds a # automatically in the url and it’s not removed from the url. It only happens in Firefox, I don’t have the issue in Chrome. I even tried to add clearHashAfterLogin: true but it doesn’t seem to do anything, the hash is not removed.

I’m using angular-oauth2-oidc(v4.0.2) with Keycloak (4.2.1.Final). I use the default routing configuration in Angular, so my URLs don’t contain any hash.

My auth.config.ts

export const authConfig: AuthConfig = {
  // Url of the Identity Provider
  issuer: 'http://keycloak.local/auth/realms/helloworld',
  requireHttps: false,
  // URL of the SPA to redirect the user to after login
  redirectUri: window.location.origin + '/index.html',
  // URL for silent refresh
  silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html',
  // Timeout before silent refresh is fired, 0.4 => fired when access token expiration time reaches 40%
  timeoutFactor: 0.5,
  showDebugInformation: true,
  // The SPA's id. The SPA is registerd with this id at the auth-server
  clientId: 'my-app',
  scope: 'openid profile email',
};

My app.component.ts

export class AppComponent {
  title = 'app';

  constructor(private oauthService: OAuthService) {
    this.configureWithNewConfigApi();
  }

  private configureWithNewConfigApi() {
    this.oauthService.configure(authConfig);
    this.oauthService.tokenValidationHandler = new JwksValidationHandler();
    this.oauthService.loadDiscoveryDocumentAndLogin();
    this.oauthService.setupAutomaticSilentRefresh();
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
shambarickcommented, Aug 19, 2018

Yes, I understand. Thank you for your help 😄

1reaction
shambarickcommented, Aug 18, 2018

I tried on Ubuntu 16.04 and 18.04 and these versions:

  • Firefox 61.0.2 (64 bit), no addons, in private browsing
  • Node 8.11.3 and 10.9.0

I get the hash as soon as I click on force silent refresh.

If you have Docker installed, you can run the following container docker run --rm -it -p 4200:80 tazounet/sample-angular-oauth2-oidc

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto Refresh Page – Get this Extension for Firefox (en-US)
Auto Refresh Page is a browser extension that automatically refreshes and reloads any page or tab after a specified number of seconds.
Read more >
window.location.reload not working for Firefox and Chrome
I want to change the user status on click of a Button, so all I am doing is, detecting the current status and...
Read more >
Microsoft Edge Browser Policy Documentation
Windows and Mac documentation for all policies supported by the Microsoft Edge Browser.
Read more >
Safari Technology Preview Release Notes - Apple Developer
Changed to check for overflow content after trimming trailing content ... Fixed Web Locks held in a Worker not getting released on page...
Read more >
Firefox/Tweaks - ArchWiki - Arch Linux
In about:config set network.protocol-handler.expose.magnet to false . In case it does not exist, it needs to be created, right click on a ...
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