I’m very new to auth0 and authenticating and facing a problem for two days with authenticating a user to our api. How i understand to get an access token is:
- A user click on a sign in button on our app.
- The user will be redirected to the auth0 hosted login screen.
- When the user has correctly signed in on any social platform or registered account then the user will be redirected to my call back URL.
- When the user is on the callback url then the user will receive an access token.
Please correct me if im wrong. Now i left out with a few questions.
Im using laravel with auth0 and used the example files of the page: Auth0 Laravel quicktart. So the login is working but when i vardump the user, i get all the user’s info but my accessToken is
But when i save the accessToken in a session on the callback url, the accessToken look like this:
tha63vkb0nnbr6vc. Isnt the length way too short for an access token? I don’t understand why i get
null when i dump the user but on a callback url it show a short length of string.
Maybe i got it totally wrong and this isnt the access token to use it for my api. On the other note, when i try to receive a token with postman i get an error:
"error_description": "Invalid authorization code". My postman look like this:
The code value ive sent is
Crk_ri8mKcKX7IcX (the red bordered string in the image).
The code value is the code parameter i took from the redirect url. And my redirect url look like this: example.com/public/callback?code=Crk_ri8mKcKX7IcX&state=5-ym0uFBxpiiBqcK_ivb2QIYxsIzAEMX#. Is this the right way to do it? i did exactly how it was indicated in the Auth0 Authorization Code API at the auth0 athorization token api but it still doesnt work.
Maybe i get this error because the user already authorized so i cant do it twice but if so, why is my access token so short and it doenst work?
I’m very new to this so please excuse me if i got it all wrong. Also my post is maybe to long to put my codes in here but my codes is exactly the same as the aformentoined Auth0 Laravel quicktart example
I would really appreciate it if someone can help me ive been struggling for 2 days now.
Thanks alot for taking your time and reading my post!!