URL parameter code=-> how to retrieve this through console.log?

Please include the following information in your post:

  • Which SDK this is regarding: React
  • SDK Version:18.2.0
  • Platform Version:
  • Code Snippets/Error Messages/Supporting Details/Screenshots:

Question:

I need to retrieve a basic bearer instead of a jwt, and am trying to retrieve an accesstoken with this. However, I am first now facing an issue with the first step, where I am going to retrieve a callback url with a code

The docs say:

Response

If all goes well, you’ll receive an HTTP 302 response. The authorization code is included at the end of the URL:

HTTP/1.1 302 Found
Location: http://localhost:3000/callback?code=AUTHORIZATION_CODE&state=xyzABC123

Is there a way to console.log authorization code in React when you are using getAccessTokenSilently?

I have also tried doing direct fetch requests by fetching this uri ```
https://dev-defghijk.eu.auth0.com/authorize?
response_type=code&
client_id=abcthisisanexampledef&
redirect_uri=http://localhost:3000/callback&
scope=SCOPE&
state=STATE


However, its not working for me.. 

Any suggestions if its not possible through getaccesstokensilently?

Hi @monhelle,

What do you mean “basic bearer”? Can you give an example?

Where are you seeing this when referencing silent auth? There should be no code exchange when doing a silent auth; a token should be returned, not an auth code.

Can you give a general overview of what you’re trying to accomplish?