Spotify Auth API 无效客户端:无效重定向 URI
我在本地计算机上访问Spotify API,没有任何问题。我向Spotify Auth提供了我的本地地址为redirect_uri参数(http:// localhost:8080),我还将此URI添加到Spotify Developer Console中,并将其添加到Whitelist中。
但是,当我将应用程序部署到AWS时,我会有这样的URL: http:// MyApp-env.eu-west-2.elasticbeanstalk.com/
所以我也将此URL添加到Spotify开发人员控制台上的白名单,并将此URL发送到Spotify授权请求为Redirect_uri参数。但是这次Spotify返回'无效客户端:无效重定向URI'错误。
AWS URL有问题吗?
编辑:我发现,当您通过在Spotify开发人员控制台中使用白名单的URI时,如果使请求的机器的主机名与URI的主机不符合URI的主机,那么Spotify返回Invalid_redirect_uri。
因此,也许是因为AWS具有负载平衡,并且机器的主机名与上面的URL不同。有什么方法可以解决这个问题吗?
I access Spotify API on my local machine without any problem. I supply to spotify auth request my local address as redirect_uri parameter(http://localhost:8080) and I also added this URI in the Spotify Developer Console to the whitelist.
But when I deploy my app to AWS I have a url like this: http://myapp-env.eu-west-2.elasticbeanstalk.com/
So I added this url to whitelist on Spotify Developer Console too and sending this url to Spotify authorization request as redirect_uri parameter. But this time spotify returns 'Invalid Client: Invalid Redirect URI' error.
Is there something wrong with the AWS url?
EDIT: I discovered that when you pass a uri that is whitelisted in the Spotify Developer Console, if the hostname of the machine making the request does not match the host of the uri, spotify returns invalid_redirect_uri.
So maybe it's because AWS has load balancing and the hostname of the machine is different than the url above. Is there any way to workaround this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了。这是因为我忘了更改 https://accottify.com.com /api/授权  request 并发送了不同(尽管有效的)将URI重定向到  https://accounts.spotify.com/api/token&token  request。两者必须匹配。
 
I solved it. It's because I forgot to change the redirect uri of the https://accounts.spotify.com/api/authorize request and sent different (although valid) redirect uri in https://accounts.spotify.com/api/token request. The two must match.