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.