# Can't exchange authorization code for an OAuth access token

**URL:** <https://www.thethingsnetwork.org/forum/t/cant-exchange-authorization-code-for-an-oauth-access-token/49369>\
**Category:** V3 Console\
**Created:** [July 2, 2021, 3:31pm UTC](https://www.thethingsnetwork.org/forum/t/cant-exchange-authorization-code-for-an-oauth-access-token/49369 "2021-07-02T15:31:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roman\_Cherepanov](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/roman_cherepanov/32/35697_2.png) [@Roman\_Cherepanov](https://www.thethingsnetwork.org/forum/u/Roman_Cherepanov)\
**Post date:** [July 2, 2021, 3:31pm UTC](https://www.thethingsnetwork.org/forum/t/cant-exchange-authorization-code-for-an-oauth-access-token/49369/1 "2021-07-02T15:31:25Z")

</div>

Hi, I am trying to obtain OAuth access token according to the documentation [Authentication | The Things Stack for LoRaWAN](https://www.thethingsindustries.com/docs/reference/api/authentication/#oauth-access-tokens) .

After obtaining authorization code, I’m trying to use it to obtain OAuth access token.

After posting the request I got a response with 403 status code with body:

```auto
{
    "code": 7,
    "message": "error:pkg/oauth:invalid_grant (invalid, expired or revoked authorization code)",
    "details": [
        {
            "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
            "namespace": "pkg/oauth",
            "name": "invalid_grant",
            "message_format": "invalid, expired or revoked authorization code",
            "code": 7
        }
    ]
}

```

---

<div class="post-metadata">

**Author:** ![Roman\_Cherepanov](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/roman_cherepanov/32/35697_2.png) [@Roman\_Cherepanov](https://www.thethingsnetwork.org/forum/u/Roman_Cherepanov)\
**Post date:** [July 9, 2021, 5:24pm UTC](https://www.thethingsnetwork.org/forum/t/cant-exchange-authorization-code-for-an-oauth-access-token/49369/2 "2021-07-09T17:24:41Z")

</div>

Solved [Can’t exchange authorization code for an OAuth access token · Issue #4375 · TheThingsNetwork/lorawan-stack · GitHub](https://github.com/TheThingsNetwork/lorawan-stack/issues/4375#issuecomment-876275439)
