I get 400 error when I try to exchange authorization code for an OAuth access token according to the documentation Authentication | The Things Stack for LoRaWAN
Steps to Reproduce
- Get authorization code with request
https://eu1.cloud.thethings.network/oauth/authorize?client_id=<oauth_client_id>&redirect_uri=<redirect_uri>&response_type=code
- Exchange authorization code for an OAuth access token using request
POST /oauth/token HTTP/1.1
Host: eu1.cloud.thethings.network
Content-Type: application/json
Authorization: Basic <AUTHORIZATION_HEADER>
Content-Length: 156
{
"grant_type": "authorization_code",
"code": "<AUTHORIZATION_CODE>"
}
Current Result
Error with code 400 and body:
{
"code": 3,
"message": "error:pkg/oauth:invalid_request (invalid or missing request parameter)",
"details": [
{
"@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
"namespace": "pkg/oauth",
"name": "invalid_request",
"message_format": "invalid or missing request parameter",
"correlation_id": "f58fe39f7984450a969c2134bac2835c",
"code": 3
}
]
}
Expected Result
Response with status code 200 and body
{
"access_token": "XXXXX",
"token_type": "bearer",
"expires_in": "3600",
"refresh_token": "YYYYY"
}