Cha*_*aro 6 google-chrome spotify google-chrome-extension google-chrome-app spotify-app
我在Spotify上注册了我的应用程序.我确保将URI添加到我的注册应用程序中.但是每次我运行这段代码时,我都会遇到同样的错误.我也在后台运行这个,所以我知道不是这样.我究竟做错了什么?
我也试着开关/spotify用/provider_cb.
var client_id = '<my_client_id>';
var redirectUri = chrome.identity.getRedirectURL() + "/spotify";
chrome.identity.launchWebAuthFlow({
"url": "https://accounts.spotify.com/authorize?client_id="+client_id+
"&redirect_uri="+ encodeURIComponent(redirectUri) +
"&response_type=token",
'interactive': true,
},
function(redirect_url) {
console.log(redirect_url);
});
Run Code Online (Sandbox Code Playgroud)
这是我的权限:
"permissions": [
"http://*/*", "tabs", "webNavigation", "activeTab", "storage", "identity",
"declarativeContent", "https://accounts.spotify.com/*",
"https://accounts.spotify.com/authorize/*"
]
Run Code Online (Sandbox Code Playgroud)
在我重新启动Chrome后第一次运行我的应用程序时,登录页面弹出就像一切正常,但在我登录后仍然得到相同的错误:
identity.launchWebAuthFlow: Authorization page could not be loaded.
Run Code Online (Sandbox Code Playgroud)
var redirectUri = chrome.identity.getRedirectURL("spotify");
Run Code Online (Sandbox Code Playgroud)
应该
"https://<app_id>.chromiumapp.org//spotify"
Run Code Online (Sandbox Code Playgroud)
getRedirectUrl将返回一个末尾带有/的url.所以你的原始代码导致:
var redirectUri = chrome.identity.getRedirectURL("spotify");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1893 次 |
| 最近记录: |