diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/user.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/api/user.go b/api/user.go index a6817caa2..9926f3ff3 100644 --- a/api/user.go +++ b/api/user.go @@ -2091,13 +2091,16 @@ func switchToSSO(c *Context, w http.ResponseWriter, r *http.Request) { func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request, service string, userData io.ReadCloser, team *model.Team, email string) { authData := "" + ssoEmail := "" provider := einterfaces.GetOauthProvider(service) if provider == nil { c.Err = model.NewLocAppError("CompleteClaimWithOAuth", "api.user.complete_switch_with_oauth.unavailable.app_error", map[string]interface{}{"Service": service}, "") return } else { - authData = provider.GetAuthDataFromJson(userData) + ssoUser := provider.GetUserFromJson(userData) + authData = ssoUser.AuthData + ssoEmail = ssoUser.Email } if len(authData) == 0 { @@ -2124,7 +2127,7 @@ func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request, return } - if result := <-Srv.Store.User().UpdateAuthData(user.Id, service, authData); result.Err != nil { + if result := <-Srv.Store.User().UpdateAuthData(user.Id, service, authData, ssoEmail); result.Err != nil { c.Err = result.Err return } |