summaryrefslogtreecommitdiffstats
path: root/app/oauth.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-07-31 08:40:48 -0400
committerGitHub <noreply@github.com>2018-07-31 08:40:48 -0400
commit709101c4df903e94c5eb954640ce8f6da98cedef (patch)
treec7043ffc3961c312f501815a2263ec90882c39c2 /app/oauth.go
parentcff9ac0df84aad2ad3a3411985c2ddc20e3b4963 (diff)
downloadchat-709101c4df903e94c5eb954640ce8f6da98cedef.tar.gz
chat-709101c4df903e94c5eb954640ce8f6da98cedef.tar.bz2
chat-709101c4df903e94c5eb954640ce8f6da98cedef.zip
Save OAuth access token to DB for consistency with other flows (#9190)
Diffstat (limited to 'app/oauth.go')
-rw-r--r--app/oauth.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/oauth.go b/app/oauth.go
index af8bca050..60ea39255 100644
--- a/app/oauth.go
+++ b/app/oauth.go
@@ -210,6 +210,13 @@ func (a *App) GetOAuthAccessTokenForImplicitFlow(userId string, authRequest *mod
return nil, err
}
+ accessData := &model.AccessData{ClientId: authRequest.ClientId, UserId: user.Id, Token: session.Token, RefreshToken: "", RedirectUri: authRequest.RedirectUri, ExpiresAt: session.ExpiresAt, Scope: authRequest.Scope}
+
+ if result := <-a.Srv.Store.OAuth().SaveAccessData(accessData); result.Err != nil {
+ mlog.Error(fmt.Sprint(result.Err))
+ return nil, model.NewAppError("GetOAuthAccessToken", "api.oauth.get_access_token.internal_saving.app_error", nil, "", http.StatusInternalServerError)
+ }
+
return session, nil
}