【发布时间】:2015-04-11 07:27:33
【问题描述】:
我在 Spotify 上注册了我的应用。我确保已将 URI 添加到我注册的应用程序中。但是每次我运行这段代码时,我都会遇到同样的错误。我也在后台运行它,所以我知道不是这样。我做错了什么?
我还尝试用/provider_cb 切换/spotify。
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);
});
这是我的权限:
"permissions": [
"http://*/*", "tabs", "webNavigation", "activeTab", "storage", "identity",
"declarativeContent", "https://accounts.spotify.com/*",
"https://accounts.spotify.com/authorize/*"
]
重新启动 Chrome 后第一次运行我的应用程序时,会弹出登录页面,好像一切都很好,但我登录后仍然遇到同样的错误:
identity.launchWebAuthFlow: Authorization page could not be loaded.
【问题讨论】:
-
尝试从权限 URL 中删除
/,使其变为"https://accounts.spotify.com/authorize*"。 -
没有区别:(
-
为什么将
"/spotify"附加到redirectUri?您可能想尝试不使用。此外,chrome.identity.getRedirectURL()返回类似 hmjkmjkepdijhoojdojkdfohbdgmmhki.chromiumapp.org 的内容,因此您可能会遇到双斜杠问题。
标签: google-chrome google-chrome-extension spotify google-chrome-app spotify-app