Skip to content

Commit 1ed50aa

Browse files
author
Kadi Kraman
committed
Add spotify example
1 parent 270ee19 commit 1ed50aa

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ These providers implement the OAuth2 spec, but are not OpenID providers, which m
4242
- [GitHub](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/) ([Example configuration](./docs/config-examples/github.md))
4343
- [Slack](https://api.slack.com/authentication/oauth-v2) ([Example configuration](./docs/config-examples/slack.md))
4444
- [Strava](https://developers.strava.com/docs/authentication) ([Example configuration](./docs/config-examples/strava.md))
45+
- [Spotify](https://developer.spotify.com/documentation/general/guides/authorization-guide/) ([Example configuration](./docs/config-examples/spotify.md))
4546

4647
## Why you may want to use this library
4748

docs/config-examples/spotify.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Spotify
2+
3+
If you don't already have a slack app, create it [here](https://developer.spotify.com/dashboard/applications).
4+
5+
Open your app, go to settings and add a redirect uri, e.g. `com.myapp://oauth`.
6+
7+
```js
8+
const config = {
9+
clientId: '<client_id>', // available on the app page
10+
clientSecret: '<client_secret>', // click "show client secret" to see this
11+
redirectUrl: 'com.myapp://oauth', // the redirect you defined after creating the app
12+
scopes: ['user-read-email', 'playlist-modify-public', 'user-read-private'], // the scopes you need to access
13+
serviceConfiguration: {
14+
authorizationEndpoint: 'https://accounts.spotify.com/authorize',
15+
tokenEndpoint: 'https://accounts.spotify.com/api/token',
16+
},
17+
};
18+
19+
const authState = await authorize(config);
20+
```

0 commit comments

Comments
 (0)