How to get user ID and use to consume endpoint

Hello @hello2, if you are doing the authentication on the browser-side (with a single page app) and Laravel acts as an API, you can take a look at our Laravel API authorization docs: Auth0 Laravel API SDK Quickstarts: Authorization You will need to create an API in the Auth0 dashboard that represents the Laravel API, if you haven’t done so already.

The Laravel API will validate the incoming access token, decode the user ID (which is included in the token as the sub claim) and return the response back.

Note that you should not be just passing the user_id from the frontend since this can be intercepted by an attacker, whereas the access token cannot be modified.

2 Likes