diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-04-25 12:38:33 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-04-25 09:38:33 -0700 |
commit | 8d1a132eda861f3e491a406233b726ff953cdffd (patch) | |
tree | f4739b7357c2887a339cebe739abca62a8744e99 /app/oauth.go | |
parent | 83ca76f8f2bfef819ba928dd1e5c94d65eed46cf (diff) | |
download | chat-8d1a132eda861f3e491a406233b726ff953cdffd.tar.gz chat-8d1a132eda861f3e491a406233b726ff953cdffd.tar.bz2 chat-8d1a132eda861f3e491a406233b726ff953cdffd.zip |
Fix OAuth SSO first account creation, add mobile support, and fix refresh tokens (#6181)
Diffstat (limited to 'app/oauth.go')
-rw-r--r-- | app/oauth.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/oauth.go b/app/oauth.go index 2c8a1c91f..5bbe744d9 100644 --- a/app/oauth.go +++ b/app/oauth.go @@ -190,9 +190,10 @@ func GetOAuthAccessToken(clientId, grantType, redirectUri, code, secret, refresh } else { //return the same token and no need to create a new session accessRsp = &model.AccessResponse{ - AccessToken: accessData.Token, - TokenType: model.ACCESS_TOKEN_TYPE, - ExpiresIn: int32((accessData.ExpiresAt - model.GetMillis()) / 1000), + AccessToken: accessData.Token, + TokenType: model.ACCESS_TOKEN_TYPE, + RefreshToken: accessData.RefreshToken, + ExpiresIn: int32((accessData.ExpiresAt - model.GetMillis()) / 1000), } } } else { @@ -273,15 +274,17 @@ func newSessionUpdateToken(appName string, accessData *model.AccessData, user *m } accessData.Token = session.Token + accessData.RefreshToken = model.NewId() accessData.ExpiresAt = session.ExpiresAt if result := <-Srv.Store.OAuth().UpdateAccessData(accessData); result.Err != nil { l4g.Error(result.Err) return nil, model.NewAppError("newSessionUpdateToken", "web.get_access_token.internal_saving.app_error", nil, "", http.StatusInternalServerError) } accessRsp := &model.AccessResponse{ - AccessToken: session.Token, - TokenType: model.ACCESS_TOKEN_TYPE, - ExpiresIn: int32(*utils.Cfg.ServiceSettings.SessionLengthSSOInDays * 60 * 60 * 24), + AccessToken: session.Token, + RefreshToken: accessData.RefreshToken, + TokenType: model.ACCESS_TOKEN_TYPE, + ExpiresIn: int32(*utils.Cfg.ServiceSettings.SessionLengthSSOInDays * 60 * 60 * 24), } return accessRsp, nil |