Skip to content

Commit 1c63bee

Browse files
author
Kadi Kraman
authored
Merge pull request #447 from FormidableLabs/chore/slack-example
Add a config example for Slack
2 parents 78c164e + 6aba298 commit 1c63bee

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ These providers implement the OAuth2 spec, but are not OpenID providers, which m
4040
- [Reddit](https://github.com/reddit-archive/reddit/wiki/oauth2) ([Example configuration](./docs/config-examples/reddit.md))
4141
- [Coinbase](https://developers.coinbase.com/docs/wallet/coinbase-connect/integrating) ([Example configuration](./docs/config-examples/coinbase.md))
4242
- [GitHub](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/) ([Example configuration](./docs/config-examples/github.md))
43+
- [Slack](https://api.slack.com/authentication/oauth-v2) ([Example configuration](./docs/config-examples/slack.md))
4344

4445
## Why you may want to use this library
4546

docs/config-examples/slack.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Slack
2+
3+
If you don't already have a slack app, create it [here](https://api.slack.com/apps).
4+
5+
Once you have an app, go "Add features and functionality" => "Permissions". Here you'll need to add two things:
6+
7+
1. Redirect URL
8+
Under "Redirect URLs", add one for your app, e.g. `com.myapp://oauth` and save
9+
10+
2. Scopes
11+
Under "Scopes", add the scopes you want to request from the user, e.g, "emoji:read"
12+
13+
```js
14+
const config = {
15+
clientId: '<client_id>', // found under App Credentials
16+
clientSecret: '<client_secret>', // found under App Credentials
17+
scopes: ['emoji:read'], // choose any of the scopes set up in step 1
18+
redirectUrl: 'com.myapp://oauth', // set up in step 2
19+
serviceConfiguration: {
20+
authorizationEndpoint: 'https://slack.com/oauth/authorize',
21+
tokenEndpoint: 'https://slack.com/api/oauth.access',
22+
},
23+
};
24+
25+
const authState = await authorize(config);
26+
```

0 commit comments

Comments
 (0)