Please help - OAuth in React-Native not working

Reply

Please help - OAuth in React-Native not working

vkp33
Casual Listener

Hi there, I'm currently a student working on a side project utilizing Spotify's api through spotify-api-web-node. I've pretty much been following this tutorial exactly (https://medium.com/javascript-in-plain-english/react-native-full-authentication-flow-with-spotify-bc...) to figure out how authentication works but after many hours of struggling I figured it would be easier to ask for help. Additional things to note are that I'm using react-native-app-auth and I'm developing in react-native for Android.

 

So far, my app requests permissions from the user's account but I keep receiving this error code after giving permissions:

"Something went wrong { [WebapiError: Bad Request] name: 'WebapiError', message: 'Bad Request', statusCode: 400 }". 

I know that to trigger this response a request with a code is being sent (not a refreshtoken). 

 

My response url is: 

https://accounts.spotify.com/en/authorize?redirect_uri=com.clientdemo:%2Foauthredirect&client_id=c53...

 

I suspect that the issue has to do with the additional query parameters "code_challenge" and "code_challenge_method" but I'm not 100% sure. 

 

Please let me know if you need any additional information at all. Pretty much all the code is provided in the link at the top since I've just been following along but I'm also happy to put snippets online if it's too much effort to parse through the article.

 

1 Reply

4ek-_v682hnvb
Casual Listener

Can you post your build.gradle file?

SUGGESTED POSTS