Missing Access Token when I refresh

The login works well, but when i refresh the page it logouts.

I added in Auth0 Configuration: http://localhost:4200 on Allowed Web Origins

export class AppComponent implements OnInit {
  constructor(public auth: AuthService) {

  ngOnInit() {
    if (this.auth.isAuthenticated()) {


It does not show any error message. I´ve put console.log in the functions of renew token or logout and it does not enter.

 public renewTokens(): void {
    this.auth0.checkSession({}, (err, authResult) => {
      if (authResult && authResult.accessToken && authResult.idToken) {
      } else if (err) {
        alert(`Could not get a new token (${err.error}: ${err.error_description}).`);

  public logout(): void {
    // Remove tokens and expiry time
    this._accessToken = '';
    this._idToken = '';
    this._expiresAt = 0;
      returnTo: window.location.origin

  public isAuthenticated(): boolean {
    // Check whether the current time is past the
    // access token's expiry time
    return this._accessToken && Date.now() < this._expiresAt;

Good morning @maurivilar! This may be the result of how you are storing your access token. When you get a moment can you reproduce this workflow for me while capturing a HAR file for us and direct message it over to me along with your tenant name? Please be sure to select “Preserve log” to catch redirects and scrub the file of user passwords before passing it over, thanks in advance!

1 Like

I wanted to follow up @maurivilar and spent sometime looking over the HAR file with our team. It appears you are using Google Developer keys which should not be used in your application. Dev keys should only be used for testing initial authentication workflow on an application. Due to this being a frequently challenged face, I will move in crafting a FAQ about this subject to help out future adventurers who run across this hurdle. Please update your keys for Google (It’s free) and let us know if you are still running into any issues, thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.