Spotify Auth API 无效客户端:无效重定向 URI

发布于 2025-01-20 09:00:43 字数 653 浏览 3 评论 0原文

我在本地计算机上访问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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无法言说的痛 2025-01-27 09:00:43

我解决了。这是因为我忘了更改 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文