# How to implement Auth0 in existing golang project

**URL:** <https://community.auth0.com/t/how-to-implement-auth0-in-existing-golang-project/90603>\
**Category:** Get Help\
**Tags:** jwt, api, login, auth0\
**Created:** [September 14, 2022, 2:57pm UTC](https://community.auth0.com/t/how-to-implement-auth0-in-existing-golang-project/90603 "2022-09-14T14:57:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eliphosifhardy](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eliphosifhardy/32/39924_2.png) [@eliphosifhardy](https://community.auth0.com/u/eliphosifhardy)\
**Post date:** [September 14, 2022, 2:57pm UTC](https://community.auth0.com/t/how-to-implement-auth0-in-existing-golang-project/90603/1 "2022-09-14T14:57:10Z")

</div>

Hi all, I want to implement Auth0 in my go app,  
currently, I am following official docs but I am getting this error when I try to validate my token which I got after the login  
which has the following info in the body

{ “iss”: “[https://dev-8g](https://dev-8g/)**[fgy.us.auth0.com/](http://fgy.us.auth0.com/)", “sub”: "auth0|63205**\*\*\*9bb4358e43b”, “aud”: “5pWA784GCz_ **QwNEXqkCMKEC6", “iat”: 1665288, “exp”: 166** 288, “sid”: "Trl3iLv_\*\*\*vlHKrH9pFYYO1bPwZon” }

but I am getting this below error when I use the jwt to validate  
I am referring to the I am using [GitHub - auth0-developer-hub/api\_standard-library\_golang\_hello-world at basic-role-based-access-control](https://github.com/auth0-developer-hub/api_standard-library_golang_hello-world/tree/basic-role-based-access-control)  
and in the audience I am giving the same value that is in my Auth0 api

{“message”:“aud not satisfied”}

what I am missing here,  
is there any way I can solve this  
can you pls help  
thankyou

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [September 29, 2022, 11:32pm UTC](https://community.auth0.com/t/how-to-implement-auth0-in-existing-golang-project/90603/3 "2022-09-29T23:32:36Z")

</div>

Hi there @eliphosifhardy welcome to the community!

I apologize for the delay on this one, but wanted to follow up to see if you were ever able to get this sorted? I was just able to run through the sample you linked to and everything functioned as expected.

It’s hard to know exactly what could be going on but I’d expect your access token to look something like this:

```auto
{
    "iss": "https://your_domain.us.auth0.com/",
    "sub": "auth0|xxxxxxx",
    "aud": [
      "https://go_api_server", <-- this is your go api identifier
      "https://your_domain.us.auth0.com/userinfo" <-- automatically included in the access token
    ],
    "iat": 1664493537,
    "exp": 1664579937,
    "scope": "openid profile email",
    "permissions": [ <-- this will be included if you enabled RBAC + "Add permissions in the Access Token".
      "read:admin-messages"
    ]
  }

```

I always recommend using [jwt.io](http://jwt.io) to visually inspect tokens. In my environment I just used our [react sample](https://github.com/auth0-samples/auth0-react-samples) with an audience set to my go API server (https://go\_api\_server) and was able to retrieve the above access token and successfully validate against the `/api/messages/admin` endpoint for example.

Let us know!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [October 14, 2022, 11:32pm UTC](https://community.auth0.com/t/how-to-implement-auth0-in-existing-golang-project/90603/4 "2022-10-14T23:32:43Z")

</div>

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