7

アプリを 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);
});

ここに私の許可があります:

"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.
4

2 に答える 2

9

使用できます

var redirectUri = chrome.identity.getRedirectURL("spotify");

getRedirectUrl末尾に / が付いた URL を返します。元のコードの結果は次のようになりました。

"https://<app_id>.chromiumapp.org//spotify"

代わりに、endpoint を引数として form url に渡すことができます

于 2015-02-11T08:39:53.463 に答える