Receiving 400 error with authorizationCodeGrant
See original GitHub issueHi,
I’m trying to create a playlist (after the user logs in), but after trying to generate a new access_token using authorizationCodeGrant(), I get “{ [WebapiError: Bad Request] name: ‘WebapiError’, message: ‘Bad Request’, statusCode: 400 }”. I am using the same code that is generated after the callback on user login.
spotifyApi.authorizationCodeGrant(code)
.then(function(data) {
spotifyApi.setAccessToken(data.body['access_token']);
spotifyApi.setRefreshToken(data.body['refresh_token']);
spotifyApi.createPlaylist(userObj['id'], playlistName, { public : false })
.then(function(data) {
sendTextMessage(sender, "success! created playlist: " + JSON.stringify(data.body))
}, function(err) {
console.log('Something went wrong createPlaylist!', err);
});
}, function(err) {
console.log('Something went wrong authorizationCodeGrant!', err);
});
Any help is appreciated, thank you!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:13
Top Results From Across the Web
Getting status code 400 (Bad Request error) from ... - MSDN
Well, i getting error 400 (Bad request) as result of executing this step 5 of Authorization code grant flow from here: ...
Read more >Get Access Token Bad Request Exception for OAuth With ...
I can get the code but when get access token by code, it throws error 400. ... Bad Request Exception for OAuth With...
Read more >AuthorizationCodeGrant HttpResponseException: 400 Bad ...
HttpResponseException: 400 Bad Request' error. trying to get the accessTokenResponse. Any idea why ? AuthorizationCodeGrant request = new ...
Read more >bad request in authorization code flow - AWS re:Post
I am about to exchange authorization code for access token but get bad request/400 error: "invalid_request" all the t...
Read more >Generic OAuth2 - 400 Error - Questions - n8n community
Hello there, I am trying to setup a generic OAuth Integration - it is working until the last step. I authenticate the service...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was getting a similar error until I added
redirectUri
to mySpotifyWebApi
instance. Like so:do I have to generate an authorizationCcode every time I run my script?