【发布时间】:2021-09-10 07:11:57
【问题描述】:
我正在尝试在自己的 netlify 上建立一个开源 github 项目来分解它并从中学习。我在通过授权页面时遇到问题。无论我创建新的客户端 ID 多少次,我仍然会收到错误非法范围。据我所知,我所有的范围都是合法的,这就是让这变得更加混乱的原因。我已经删除了我的 spotify api 仪表板,现在重新制作了 3 次,但一点运气都没有。任何帮助或建议将不胜感激。我的仪表板上的重定向 URI 和客户端 ID 与我的代码中的相同(附在下面)。
const config = {
environment: 'development',
remoteUrl: 'https://api.spotify.com/v1/',
spotifyAuthparams: {
client_id: '***********************0b4de86f',
redirect_uri: `${origin}/spotifycallback`,
scope:
'user-read-private user-top-read user-read-recently-played user-read-currently-playing playlist-modify-public playlist-modify-private playlist-read-collaborative user-read-play-history',
show_dialog: true,
},
};
export default config;
此代码显示 $(origin) 返回的内容。
const { protocol, hostname, port } = window.location;
const origin = `${protocol}//${hostname}${port ? `:${port}` : ''}`;
const config = {
protocol,
hostname,
port,
origin,
spotifyAuthority: 'https://accounts.spotify.com/authorize',
};
export default config;
【问题讨论】:
标签: javascript api scope spotify