Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Going through Slack OAuth flow should update the user's token and sco…
Browse files Browse the repository at this point in the history
…pes.

This is necessary because the OAuth access token could become invalid or revoked. Also the application's required scopes could change. If these things happen and we need to have the user auth again, the new tokens/scopes should be updated on that user.
  • Loading branch information
sundeepgupta committed Aug 8, 2016
1 parent 677a4c7 commit adeeb7e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/SlackBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,16 @@ function Slackbot(configuration) {
isnew = true;
user = {
id: identity.user_id,
access_token: auth.access_token,
scopes: scopes,
team_id: identity.team_id,
user: identity.user,
};
}

// Always update these because the token could become invalid
// and scopes could change.
user.access_token = auth.access_token;
user.scopes = scopes;

slack_botkit.storage.users.save(user, function(err, id) {

if (err) {
Expand Down

0 comments on commit adeeb7e

Please sign in to comment.