Skip to content

Commit fa9b70f

Browse files
author
andy
committed
update spotify configuration with token exchange service
1 parent 9000c28 commit fa9b70f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/config-examples/spotify.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,27 @@ const config = {
2020

2121
const authState = await authorize(config);
2222
```
23+
24+
## Managing Client Secrets
25+
26+
In order to avoid storing the `clientSecret` in the client, Spotify has published a token exchange package that can be used to move this step to the backend:
27+
https://github.com/bih/spotify-token-swap-service
28+
29+
The tokenEndpoint should then point to whereever you are hosting this server, and be sure to remove the secret from your app:
30+
31+
```js
32+
const config = {
33+
clientId: '<client_id>', // available on the app page
34+
redirectUrl: 'com.myapp:/oauth', // the redirect you defined after creating the app
35+
scopes: ['user-read-email', 'playlist-modify-public', 'user-read-private'], // the scopes you need to access
36+
serviceConfiguration: {
37+
authorizationEndpoint: 'https://accounts.spotify.com/authorize',
38+
tokenEndpoint: 'https://my-token-service/api/token',
39+
},
40+
};
41+
42+
const authState = await authorize(config);
43+
```
44+
45+
46+

0 commit comments

Comments
 (0)