我确实复制并粘贴了Spotify 示例代码,并将其粘贴到我/public/index.html的 React + Electron 项目的文件中
...
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script src="https://sdk.scdn.co/spotify-player.js"></script>
<script>
window.onSpotifyWebPlaybackSDKReady = () => {
const token = '<access token>';
const player = new Spotify.Player({
name: 'Web Playback SDK Quick Start Player',
getOAuthToken: cb => { cb(token); }
});
// Error handling
player.addListener('initialization_error', ({ message }) => { console.error(message); });
player.addListener('authentication_error', ({ message }) => { console.error(message); });
...
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Uncaught (in promise) …Run Code Online (Sandbox Code Playgroud)