I'm trying to receive refresh_token
for my Ionic app, I successfully receive access_token
.
I receive code
(authorization_code
or access_token
) from endpoint https://accounts.spotify.com/authorize?client_id=
in my TypeScript project, I pass it to cURL
to test how to get refresh_token
but the only thing which I receive its error.
curl -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic MzBhNT...ZWIyZWQ=" -d grant_type=authorization_code -d code=BQAjgZOFne3p8PB4ARJkrXtq...kI4xJvhQ7SutZoJqVWILCY -d redirect_uri=http%3A%2F%2Flocalhost%3A8100%2Fmain -X POST https://accounts.spotify.com/api/token
Expected output:
{
"access_token": "NgCXRK...MzYjw",
"token_type": "Bearer",
"scope": ...,
"expires_in": 3600,
"refresh_token": "NgAagA...Um_SHo"
}
But received error:
{"error":"invalid_grant","error_description":"Invalid authorization code"}