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.

Emit "silent_refresh_timeout" error event during 5 -> 10 minutes

See original GitHub issue
  • When I come back my page duration is 5 => 10 minutes, a error raises like bellow:
  • refresh error OAuthErrorEvent {type: “silent_refresh_timeout”, reason: null, params: null}.
  • Can you can help me fix it and explain why? thanks so much

  • this is my config:

export const authConfig: AuthConfig = {

// Url of the Identity Provider issuer: BaseHostConstant.authorityUrl,

// URL of the SPA to redirect the user to after login redirectUri: ${BaseHostConstant.baseUrl}login,

// URL of the SPA to redirect the user after silent refresh silentRefreshRedirectUri: ${BaseHostConstant.baseUrl}silent-refresh,

// The SPA’s id. The SPA is registerd with this id at the auth-server clientId: BaseHostConstant.ssoClientId,

responseType: ‘id_token token’,

oidc: true,

// set the scope for the permissions the client should request // The first three are defined by OIDC. The 4th is a usecase-specific one scope: ‘openid profile email roles hrtoolInternalApi organization’,

showDebugInformation: true,

sessionChecksEnabled: true,

// redirect to login after logout postLogoutRedirectUri: BaseHostConstant.baseUrl,

// timeoutFactor: 0.002 };

private oauthConfigure() { this.oauthService.configure(authConfig); this.oauthService.tokenValidationHandler = new JwksValidationHandler(); this.oauthService.loadDiscoveryDocumentAndTryLogin();

const loginOptions = new LoginOptions();
loginOptions.disableOAuth2StateCheck = true;
this.oauthService.loadDiscoveryDocumentAndLogin(loginOptions).then((res) => {
  if (!this.authService.isAuthenticated) {
    this.oauthService.silentRefresh();
  }
});

}

Component({ template: `` }) export class SilentRefreshComponent implements OnDestroy { private timer;

constructor(private authService: OAuthService) {
    this.timer = setTimeout(() => {
        this.oauthService.silentRefresh();
    }, 30000);
}

ngOnDestroy() {
    clearTimeout(this.timer);
}

}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
uncledentcommented, Jun 4, 2018

I have made everything as described here https://manfredsteyer.github.io/angular-oauth2-oidc/docs/additional-documentation/refreshing-a-token-(silent-refresh).html, but still no success. The token gets updated, but the error does not disappear.

3reactions
manfredsteyercommented, May 21, 2018

Thanks.

You have to consider the following:

  • You need an silent-refresh.html
  • You need to define it as an asset so that it is copied over to the dist folder
  • You need to point to it using a config property

Details can be found here: https://manfredsteyer.github.io/angular-oauth2-oidc/docs/additional-documentation/refreshing-a-token-(silent-refresh).html

In Angular 6 you have to add the src folder when setting up the assets:

"assets": [
              "src/silent-refresh.html"
],
Read more comments on GitHub >

github_iconTop Results From Across the Web

Silent refresh not working with OIDC-client in Angular 5
The problem is that you are not asking access_token from azure AD, only id_token. You must set response_type to id_token token to get...
Read more >
Angular route not working on refresh. ng add ... - Unoeste
Angular route not working on refresh. ng add @angular/elements. Suppose a user has been authenticated but not authorized to visit the child routes, ......
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