I'm working on my first app using ruby on rails and have run into a few problems when I deploy to Heroku. When I sign into Spotify on my app I get an error saying:
INVALID_CLIENT: Invalid redirect URI
in my console the error reads:
Failed to load resource: the server responded with a status of 400 (Bad Request)
At first I thought it was an issue with my Client ID and Secret, because I ran into a similar error locally. So I regenerated new ones and I still have the same issue.
Then I noticed my callback URI didn't include a 's' in the callback url, so I added it and changed the callback on my Spotify App page, but I still receive the same error.
Although I changed the callback url in Spotify's app page, when I am in my app and I try to log in the url still doesn't contain an 's'.
Am I missing something or is something happening on Spotify's end? (I don't have this issue when I run this app locally)
The redirect URI can be any valid URI (it does not need to be accessible) such as http://example.com , http://localhost or http://127.0.0.1:9090 .
While working on a web based client, you have to ensure that the redirect URI passed while authentication, is the same as the one given during registration. If the redirect uri is not the one given during registration, an invalid redirect uri error will be thrown.
A redirect URI, or reply URL, is the location where the authorization server sends the user once the app has been successfully authorized and granted an authorization code or access token.
Client ID, the unique identifier of your app.
The important thing is that the redirect URI specified in My Applications match the redirect URI that you're specifying in the request to Spotify's API.
My guess would be that the redirect URIs still doesn't match, since that's the error message you're getting. Mind that editing the URI isn't enough, you need to click the 'Save' button to persist your changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With