Skip to content

Commit

Permalink
acessTokenGetter
Browse files Browse the repository at this point in the history
  • Loading branch information
cathykc committed Dec 1, 2020
1 parent 0c9b1f7 commit 9706fe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/providers/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ export default (options) => {
name: 'Slack',
type: 'oauth',
version: '2.0',
scope: 'identity.basic identity.email identity.avatar',
scope: [],
params: { grant_type: 'authorization_code' },
accessTokenUrl: 'https://slack.com/api/oauth.v2.access',
accessTokenGetter: (json) => json.authed_user.access_token,
authorizationUrl: 'https://slack.com/oauth/v2/authorize',
additionalAuthorizeParams: { user_scope: 'identity.basic,identity.email,identity.avatar' },
profileUrl: 'https://slack.com/api/users.identity',
profile: (profile) => {
const { user } = profile
Expand Down
2 changes: 1 addition & 1 deletion src/server/lib/oauth/callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ async function _getOAuthAccessToken (code, provider, callback) {
// Clients of these services suffer a minor performance cost.
results = querystring.parse(data)
}
const accessToken = results.access_token
const accessToken = provider.accessTokenGetter ? provider.accessTokenGetter(results) : results.access_token
const refreshToken = results.refresh_token
callback(null, accessToken, refreshToken, results)
}
Expand Down

0 comments on commit 9706fe2

Please sign in to comment.