To get access token instead of code and state after authentication

Sir, I’m using auth0 authentication for my app and I’ve set custom callback domain, but now I’m getting code instead of access token. So please send me any solution how can I get access token back instead of code and state

Hello @shikharrastogi36

Welcome to the Auth0 Community!

The reason you are getting code in the callback is because of the type of authorization flow you are using
In your application, please find below various authentication and authorization flows which Auth0 supports:

In case you need directly the access token instead of the code, you need to use Implicit grant type as your Authentication and authorization flow. I suggest to have a look at the below documentation which details how you can Implement the Implicit grant type:

Also it will be good to have a read to this link to understand which flow you should use based on your
Application and use case:

Hope this helps!

I started to have the same issue.
I have created an auth0 Application “Single Page Application”.

But after authenticating with Auth0, the response to my /callback endpoint is sending state and code params, instead of the expected access_token, id_token, expires, and more.

I have checked the Grant Types configuration, and I have all of these are properly checked:

  • Implicit
  • Authorization Code
  • Refresh Token

The documentation says this should be enough, but since the /callback request is not receiving the proper data, the callback to auth0Client.parseHash(callback) is resolving with null error and null authResult params.

Any ideas please?

This solution does not seem to work in my React app, I am not using Node Express. I am deploying to Apache after I compile my code, do I need to set up Apache to accept the authorization? I am really confused, and would really prefer to use the Single Sign-On, it was simple to set up. Why does that not work? Why does the URL have the code and state variables anyway? Is there a way to remove that? It seems fine with local development, but, once I deploy it to Apache it does not work. I have five sites that are down because I can’t get this to work with my React app.