# I keep getting bad verification code when requesting github access token Asked today Modified today Viewed 9 times

**URL:** <https://community.auth0.com/t/i-keep-getting-bad-verification-code-when-requesting-github-access-token-asked-today-modified-today-viewed-9-times/124496>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [January 9, 2024, 7:10pm UTC](https://community.auth0.com/t/i-keep-getting-bad-verification-code-when-requesting-github-access-token-asked-today-modified-today-viewed-9-times/124496 "2024-01-09T19:10:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TadewosBell](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tadewosbell/32/53806_2.png) [@TadewosBell](https://community.auth0.com/u/TadewosBell)\
**Post date:** [January 9, 2024, 7:10pm UTC](https://community.auth0.com/t/i-keep-getting-bad-verification-code-when-requesting-github-access-token-asked-today-modified-today-viewed-9-times/124496/1 "2024-01-09T19:10:57Z")

</div>

I am using auth0-vue for user authentication. I have added the github login connection in my auth0 console, selected the permission to view the user repo. I have also created the github auth0 application in my developer settings and the login/permession process in my frontend work as expected. Then when the code and state is returned after the user logs in I am sending the code to my back end server to make the following request for the github access token:

```auto
def get_github_token(code: str, state: str = None):
    conn = http.client.HTTPSConnection("github.com")

    payload = ""

    conn.request("POST", f"/login/oauth/access_token?code={code}&client_id={my_github_client_id}&client_secret={my_github_client_secret}", payload)

    res = conn.getresponse()
    data = res.read()

    print(data.decode("utf-8"))

    return None

```

But I keep getting:

```auto
error=bad_verification_code&error_description=The+code+passed+is+incorrect+or+expired.&error_uri=https%3A%2F%2Fdocs.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-oauth-app-access-token-request-errors%2F%23bad-verification-code

```

I have double and triple checked the github client id and secret I am using and they are correct, Where am I going wrong?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 18, 2024, 10:19pm UTC](https://community.auth0.com/t/i-keep-getting-bad-verification-code-when-requesting-github-access-token-asked-today-modified-today-viewed-9-times/124496/3 "2024-01-18T22:19:18Z")

</div>

Hi @TadewosBell,

Welcome to the Auth0 Community!

The code is single use and can’t be used to get a second token in your backend. In your backend, you want to get the IDP (GitHub) token _directly from the management API._

You can do that following this guide:

> **[Identity Provider Access Tokens](https://auth0.com/docs/secure/tokens/access-tokens/identity-provider-access-tokens)**
>
> Understand third-party access tokens issued by identity providers after user authentication and how to use them to call the third-party APIs.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 1, 2024, 10:20pm UTC](https://community.auth0.com/t/i-keep-getting-bad-verification-code-when-requesting-github-access-token-asked-today-modified-today-viewed-9-times/124496/4 "2024-02-01T22:20:03Z")

</div>

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