Auth0 Home Blog Docs

accessToken = null?



I have imported auth0-js like this:

import auth0 from 'auth0-js';

auth0 = new auth0.WebAuth({
        clientID: '<myClientId>',
        domain: '<MyDomain>',
        responseType: 'token id_token',
        audience: 'https://<MyDomain>',
        redirectUri: 'http://localhost:3000/#!/sample',      
        scope: 'openid profile'

then calling


Which works great. But accessToken is null, but idToken is there. So can’t work with either API or User profile. Can see that the accesstoken is in the request url after I’ve logged in from the lock. So maybe a problem with parseHash?

auth0.parseHash((err, authResult) => {
      console.log('Authenticating', authResult);
      // TO FIX: Get access Token
      if (authResult && authResult.idToken) {
        window.location.hash = '';
      } else if (err) {
      } else {
        console.log('Access token or Id token missing');


"auth0-js": "8.7.0",


Can you provide more information on where you see the accessToken is null? Are you querying localStorage?


Yes, ofc. There’s no accesstoken in the authResult, after logging in.

So authResult in the parseHash method has an object with property { accessToken: null, … }


One thing I noticed: your audience parameter is incorrect - The audience parameter should be the identifier of the API for which you are requesting access (an API you have configured in Auth0). You do not need to request access for the Auth0 /userinfo endpoint.

If you see the access_token in the URL hash, it is likely an issue in the client - I’d suggest taking a look at our Angular 2 quickstart samples to ensure you have implemented it as outlined:


I see part of the access-token in the url I think. When I try to copy it from the URL and actually use it, it’s much smaller than normal, and doesn’t work.

I followed the tutorial already. And in the link that you provide it’s done exactly this way; passing userinfo to the audience.

auth0 = new auth0.WebAuth({
    clientID: AUTH_CONFIG.clientID,
    domain: AUTH_CONFIG.domain,
    responseType: 'token id_token',
    audience: `https://${AUTH_CONFIG.domain}/userinfo`,
    redirectUri: 'http://localhost:4200/callback',
    scope: 'openid'


In my other angular app, I don’t pass audience at all. I’ve made several apps with Auth0, and it’s always a real pain of going back and forth multiple documentation, to set it up. But never tried not actually getting tokens back.


Apologies for bringing back a dead thread, but i’m having the same issue with my app. I’ve even created a new test angular 4/5 application and while it can authenticate, it does NOT redirect to the page that i want it to, instead it refresh with the access token in the URL, but when i inspect the “profile” object, its null.

And strangely enough, i can see in the Auth0 client dashboard that i have successfully signed in, however, using “{{auth.isAuthenticated()}}” on the HTML returns FALSE… So while it looks like its authenticated, it hasn’t returned an access token…??

I have the sample application if the support team are still reading these threads…?


Hi, did anyone find a solution to this issue? I am having the same issue, the access_token returned is null. I have other variables returned such as id_token.


I see that this is happening only when I have some sort of routing in the same app. If I remove the routing either ngRoute or ui.router, then I get back an access token. If I have either of these routes in place, then I get back a null access token, I get values for other parameters like id token, etc, but only access token is null.
Need to investigate why this is the case.


I was finally able to resolve the issue by adding the following line when configuring the app:


Hopefully this helps someone who has been struggling with this issue.