authorizationCodeGrant not working.
See original GitHub issueHey, I have the following code on my firebase server for authenticating a user:
var SpotifyWebApi = require('spotify-web-api-node');
async function proxySpotifyToken(req, res){
const spotifyApi = new SpotifyWebApi({
clientId: "myId",
clientSecret: "mySecret",
redirectUri: "com.myRNapp:/callback",
});
const code = req.body.code;
// console shows code
console.log(code);
if(code){
spotifyApi.authorizationCodeGrant(code).then(
data => {
return res.json(data.body)
},
err => {
console.log('Something went wrong!', err)
}
).catch((oError) => {
return res.json(oError)
})
}
}
module.exports = {
authentication: proxySpotifyToken
};
I’m using react-native-app-auth to make the call to the server and pass on the code. As you can see, I’m logging the code in the Firebase console and it does shows a string, so that seems to be working.
Whatever I try, It always catches the following error: Something went wrong! { [WebapiError: Bad Request] name: ‘WebapiError’, message: ‘Bad Request’, statusCode: 400 }
Am i doing something wrong here?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
spotifyApi.authorizationCodeGrant is not a function · Issue ...
Expected: authorizationCodeGrant should be a function available for access using the library. Actual: spotifyApiInstanceWithCredentials.
Read more >spotify-web-api-node: authorizationCodeGrant() give a 400
Then, I use this code to get an Access Token and a Refresh Token from Spotify and perform all the actions I want....
Read more >Passport's Authorization Code Grant not working out of the box!
So when we run the /redirect in the browser, and the user is not logged in to our auth server, the login page...
Read more >Troubleshooting Guide for Cisco Unity Connection Release 12.x
This section explains various problems that may occur while using Authorization Code Grant Flow along with the resolution.
Read more >Authorization Code Grant Flow Error Messages in the Login ...
The following table lists errors that are visible in the Detail column of the Login Audit Trail Results. Problem. Authorization Code Grant Flow...
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
Thanks @AquaWolf! Got it working. For those interested, here’s a discussion including Spotify engineers regarding this problem: https://community.spotify.com/t5/Spotify-for-Developers/Authentication-API-failing-in-production-right-now/td-p/4959662
Ok i dived a bit deeper and found that somehow i needed a codeverifier for the authorizationCodeGrant method. Here is the new method: