首页 > 解决方案 > Spotify web api回调php中的错误

问题描述

我已经尝试使用 jwilsson 的 Spotify-web-API,如下所述:https ://github.com/jwilsson/spotify-web-api-php/blob/master/docs/examples/access-token-with-authorization -代码流.md

我获得了工作授权,我在重定向的 URL 中收到代码并能够提取它,但是当我到达回调页面时出现以下错误:

致命错误:未捕获的 SpotifyWebAPI\SpotifyWebAPIAuthException:C:...\vendor\jwilsson\spotify-web-api-php\src\Request.php:49 中的重定向 URI 无效 堆栈跟踪:#0 C:...\vendor\ jwilsson\spotify-web-api-php\src\Request.php(242): SpotifyWebAPI\Request->parseBody(Object(stdClass), 400) #1 C:...\vendor\jwilsson\spotify-web-api -php\src\Request.php(99): SpotifyWebAPI\Request->send('POST', ' https://account ...', 'client_id=effb4...', Array) #2 C:. ..\vendor\jwilsson\spotify-web-api-php\src\Session.php(217): SpotifyWebAPI\Request->account('POST', '/api/token', Array, Array) #3 C: ...\callback.php(17): SpotifyWebAPI\Session->requestAccessToken('AQB5DWrr3FQ_WVq...') #4 {main} 在 C:...\vendor\jwilsson\spotify-web-api-php\源\请求。第 49 行的 php

我目前拥有的流程是:1)index.html 2)auth.php(进行身份验证并重定向到 callback.php)3)callback.php(获取访问令牌并使用我的 API 调用“app”重定向到页面.php") 4) app.php

第 2 点和第 3 点的页面在 Spotify 中注册为重定向 URI

标签: php

解决方案


推荐阅读