You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+53-70Lines changed: 53 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,10 +16,11 @@ The omniauth-slack gem contains the Slack OAuth2 strategy for [OmniAuth](https:/
16
16
the Slack [OAuth2 v2 API](https://api.slack.com/authentication/oauth-v2)
17
17
and the Slack OAuth2 v1 API.
18
18
19
-
20
19
This Gem supports Slack v2 API bot and user tokens, as well as v1 API workspace apps and tokens.
21
20
Slack "classic" apps and tokens should also work but are not fully tested.
22
21
22
+
Omniauth-slack does not enforce a Ruby version constraint. The Gem will work with Ruby versions 2.3 through 2.6.x. Older versions of Ruby may work but are not tested. Ruby version 2.7.x may work but is not yet tested.
23
+
23
24
24
25
## Before You Begin
25
26
@@ -72,7 +73,7 @@ For a **[Sinatra](http://sinatrarb.com/)** app: <span name="sinatra-app" id=
72
73
```
73
74
74
75
75
-
If you are using **[Devise](https://github.com/plataformatec/devise)** then it will look like this:
76
+
If you are using **[Devise](https://github.com/plataformatec/devise)** then it *should* look like this:
76
77
77
78
```ruby
78
79
Devise.setup do |config|
@@ -147,7 +148,7 @@ Some of these options can also be given at runtime in the authorization request
147
148
More information on provider and authentication options can be found in omniauth-slack's supporting gems [omniauth](https://github.com/omniauth/omniauth), [oauth2](https://github.com/oauth-xx/oauth2), and [omniauth-oauth2](https://github.com/omniauth/omniauth-oauth2).
@@ -160,14 +161,21 @@ More information on provider and authentication options can be found in omniauth
160
161
Specify the scopes for the authorization request.
161
162
162
163
163
-
### team
164
+
### team: string
165
+
*optional*
166
+
167
+
### team_domain: string
164
168
*optional*
165
169
166
170
```ruby
167
-
:team => 'team-id'
168
-
# and/or
169
-
:team_domain => 'team-subdomain'
171
+
:team => 'team-id',
172
+
173
+
# and/or
174
+
175
+
:team_domain => 'my_team_domain'
170
176
```
177
+
Requests authentication against a specific team.
178
+
171
179
172
180
> If you don't pass a team param, the user will be allowed to choose which team they are authenticating against. Passing this param ensures the user will auth against an account on that particular team.
173
181
@@ -206,8 +214,8 @@ Sign in behavior with team settings and signed in state can be confusing. Here i
206
214
* Current authorization is not requesting any non-identity scopes (but it's ok if the token already has non-identity scopes).
@@ -219,7 +227,7 @@ Set a custom redirect URI in your app, where Slack will redirect-to with an auth
219
227
The redirect URI, whether default or custom, MUST match a registered redirect URI in [your app settings on api.slack.com](https://api.slack.com/apps).
220
228
221
229
222
-
### callback_path
230
+
### callback_path: string
223
231
*optional*
224
232
225
233
```ruby
@@ -231,7 +239,7 @@ The redirect URI, whether default or custom, MUST match a registered redirect UR
231
239
Set a custom callback path (path only, not the full URI) for Slack to redirect-to with an authorization code. This will be appended to the default redirect URI only. If you wish to specify a custom redirect URI with a custom callback path, just include both in the `:redirect_uri` setting.
232
240
233
241
234
-
### skip_info
242
+
### skip_info: boolean
235
243
*optional*
236
244
237
245
```ruby
@@ -242,39 +250,8 @@ Skip building the `InfoHash` section of the `AuthHash` object.
242
250
243
251
If set, only a single api request will be made for each authorization. The response of that authorization request may or may not contain user and email data.
244
252
245
-
<!--
246
-
### Preload Data with Threads
247
-
*optional*
248
-
249
-
```ruby
250
-
:preload_data_with_threads => 0
251
-
```
252
-
*This option is ignored if `:skip_info => true` is set.*
253
-
254
-
With passed integer > 0, omniauth-slack preloads the basic identity-and-info API call responses, from Slack, using *<#integer>* pooled threads.
255
-
256
-
The default `0` skips this feature and only loads those API calls if required, scoped, and authorized, to build the AuthHash.
Use this list in cooperation with the `:dependencies` option to fine-tune your `info` section, `extra` section,
274
-
and post-authorization API call behavior and order.
275
-
-->
276
-
277
-
### pass_through_params
254
+
### pass_through_params: array-of-strings
278
255
*optional*
279
256
280
257
Options for `scope`, `team`, `team_domain`, and `redirect_uri` can also be given at runtime via the query string of the omniauth-slack authorization endpoint URL `/auth/slack?team=...`. The `scope`, `team`, and `redirect_uri` query parameters will be passed directly through to Slack in the OAuth2 GET request:
@@ -299,14 +276,9 @@ To allow all pass-through options.
Client options control the behavior of the `OAuth2::Client`, which handles the
@@ -407,11 +379,11 @@ To extract data from the API response, call `parsed` on the response object.
407
379
408
380
409
381
## The Auth Hash
410
-
<!-- *TODO: Give a quick bit about what an auth_hash object is.* -->
411
382
412
-
Each Successful OmniAuth authorization places an [AuthHash](https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema) object in the environment `env['omniauth.auth']`.
413
-
The AuthHash is just an enhanced hash object containing data from the [OAuth2](https://github.com/oauth-xx/oauth2) response received from
414
-
the get-token API call made during the OmniAuth callback phase.
383
+
Each Successful OmniAuth authorization places an
384
+
[AuthHash](https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema) object in the environment `env['omniauth.auth']`.
385
+
The AuthHash is just an enhanced hash object containing data from the[OAuth2](https://github.com/oauth-xx/oauth2)
386
+
response received from the get-token API call made during the OmniAuth callback phase.
415
387
See OmniAuth's documentation for the AuthHash schema definition.
416
388
417
389
With the growing number of multi-dimensional data structures for the various token response objects,
@@ -424,8 +396,8 @@ but it will no longer be mapping specific data points from the access-token
424
396
to specific fields in the AuthHash `info` section (other than `info` fields that are 'required'
425
397
by the OmniAuth::AuthHash schema spec).
426
398
427
-
Application developers are welcome to define their own `info` section
428
-
directly within the omniauth-slack strategy.
399
+
Application developers are welcome to define their own **`info`** section directly within the omniauth-slack strategy.
400
+
And the same customization can be done for any of the top-level AuthHash sections.
429
401
430
402
```ruby
431
403
classOmniAuth::Strategies::Slack
@@ -440,7 +412,7 @@ directly within the omniauth-slack strategy.
440
412
```
441
413
442
414
If you want to build your own `info` section *and* have it appended to omniauth-slack's default
443
-
`info` section, then subclass the strategy and use that subclass as your provider.
415
+
`info` section, then subclass the strategy and use that subclass as your `OmniAuth`provider.
The same customization can be done for any of the top-level AuthHash sections.
460
434
461
-
The `credentials` section of the AuthHash will contain the access-token string, the awarded
435
+
The **`credentials`** section of the AuthHash will contain the access-token string, the awarded
462
436
scopes, and any other essential authentication information returned in the OAuth2 response.
463
437
464
-
The `extra` section contains two hash keys:
438
+
The **`extra`** section contains two hash keys:
465
439
*`:scopes_requested` hash, which are the scopes requested during the current authorization.
466
440
*`:raw_info` hash, which contains the raw response object from any API calls made during the callback phase.
467
441
@@ -639,23 +613,32 @@ Don't forget to fill in your Slack API credentials. Then start up Rails, and poi
639
613
When a successful authorization cycle completes, your browser should end up with a yaml representation of the auth_hash and access_token objects. What happens next is entirely up to your application.
640
614
641
615
642
-
## Advanced
643
-
644
-
* Customize AuthHash with additional API calls during the callback phase.
616
+
## Advanced / Experimental
645
617
646
-
* Deep debug with `ENV['OMNIAUTH_SLACK_DEBUG']=true`
618
+
* Deep debug with `ENV['OMNIAUTH_SLACK_DEBUG']=true`.
0 commit comments