Go server - need help to verify Auth0 token from React (frontend) and get the userId


Our setup is a React app on the frontend which uses ‘@auth0/auth0-spa-js’ library to connect the user to our Auth0 account.

On the backend we have a Go server which exposes our company API services.

My goal is to have the client pass an “Authorization” token which can be verified by our Go backend server - this will help us block non-authenticated users. Also, we want to be able to parse the userID out of that Auth token so we can provide a “tailor made” response for the specific user.

I tried to define our backend as a “custom API” on Auth0 dashboard. And also use an access token to send to our backend:

const accessToken = await auth0Client.getTokenSilently({audience: ‘http://koala-backend.cluster.koalaops.com/koala’});

However, I didn’t manage to verify this token on the Go server OR get the user ID from the auth-token. I followed these instructions:

Can you please help?

Hi @oded1,

Welcome to the Auth0 Community!

What was happening? Were you able to get a token successfully? If so, can you please provide an example token? Additionally, could you provide more context on what is happening; i.e. errors, code snippets, etc.

Hi Dan, thank you for getting back to me. We had to move into other priorities. I should get back to this task soon and will update here if needed. Thank you for trying to help

1 Like

Sounds good, let me know.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.