我有一个带有React前端的Rails API。尝试使用Rspotify库(https://github.com/guilhermesad/rspotify)进行OAuth。
每次单击登录按钮时,都会出现此错误:INVALID_CLIENT:无效的重定向URI
这是我的代码:
routes.rb
get '/auth/spotify/callback/', to: 'api/v1/users#spotify'
登录链接
<a href="http://localhost:3001/auth/spotify/">Log In</a>
在Spotify上列入白名单的网址:http://localhost:3001/auth/spotify/callback/
Api / V1 / users_controller.rb
spotify_user = RSpotify::User.new(request.env['omniauth.auth'])
请帮助我!