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 = '';
this.setSession(authResult);
this.router.go('auth');
} else if (err) {
this.router.go('auth');
console.log(err);
} else {
console.log('Access token or Id token missing');
}
});
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.
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.