# Getting User Information Using Go API Authorization

**URL:** <https://community.auth0.com/t/getting-user-information-using-go-api-authorization/77971>\
**Category:** Get Help\
**Tags:** go, jwt\
**Created:** [February 9, 2022, 1:41pm UTC](https://community.auth0.com/t/getting-user-information-using-go-api-authorization/77971 "2022-02-09T13:41:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![howlettga](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/howlettga/32/18481_2.png) [@howlettga](https://community.auth0.com/u/howlettga)\
**Post date:** [February 9, 2022, 1:41pm UTC](https://community.auth0.com/t/getting-user-information-using-go-api-authorization/77971/1 "2022-02-09T13:41:44Z")

</div>

I am following the Go API: Authorization tutorial to secure my GoLang API: [Auth0 Go API SDK Quickstarts: Authorization](https://auth0.com/docs/quickstart/backend/golang)

This all works fine and I can validate a token. But ultimately I need some user information from the logged-in user, their `user_id` at the least. Is this something the auth0 validator library is able to handle in the process of validating the token? I was expecting some helper functionality to pull this information but I can’t find any functions in the library doing this. Or do I need to manually pull the user information myself using the token after it’s validated?

I was kind of expecting to get an ID Token from validation but that object doesn’t seem to exist for me.

---

<div class="post-metadata">

**Author:** ![howlettga](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/howlettga/32/18481_2.png) [@howlettga](https://community.auth0.com/u/howlettga)\
**Post date:** [February 10, 2022, 11:14pm UTC](https://community.auth0.com/t/getting-user-information-using-go-api-authorization/77971/2 "2022-02-10T23:14:00Z")

</div>

So the main issue here was I was retrieving an access token with a client grant from an app so I wasn’t logged in as a user 🤦.

Once you pass an access token actually tied to a user, the `user_id` is available on the valid claim:

```auto
claims := r.Context().Value(jwtmiddleware.ContextKey{}).(*validator.ValidatedClaims)
claims.RegisteredClaims.Subject

```

I do think it would be nice if the ValidateToken method was more exposed from the library so I could call it in my middleware and define the context however I want, with the valid claims inside of my own struct. Still this is great 🙂

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 11, 2022, 9:43am UTC](https://community.auth0.com/t/getting-user-information-using-go-api-authorization/77971/3 "2022-02-11T09:43:40Z")

</div>

Glad you have figured it out and thanks for sharing with the rest of community! I’m gonna relay that feedback to appropriate team!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 22, 2022, 2:38pm UTC](https://community.auth0.com/t/getting-user-information-using-go-api-authorization/77971/4 "2022-02-22T14:38:21Z")

</div>


