Merge pull request #2234 from enj/enj/i/password_grant_access_token
Return valid JWT access token from password grant
This commit is contained in:
commit
18311aa44d
1 changed files with 9 additions and 2 deletions
|
@ -1106,10 +1106,17 @@ func (s *Server) handlePasswordGrant(w http.ResponseWriter, r *http.Request, cli
|
||||||
Groups: identity.Groups,
|
Groups: identity.Groups,
|
||||||
}
|
}
|
||||||
|
|
||||||
accessToken := storage.NewID()
|
accessToken, err := s.newAccessToken(client.ID, claims, scopes, nonce, connID)
|
||||||
|
if err != nil {
|
||||||
|
s.logger.Errorf("password grant failed to create new access token: %v", err)
|
||||||
|
s.tokenErrHelper(w, errServerError, "", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
idToken, expiry, err := s.newIDToken(client.ID, claims, scopes, nonce, accessToken, "", connID)
|
idToken, expiry, err := s.newIDToken(client.ID, claims, scopes, nonce, accessToken, "", connID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.tokenErrHelper(w, errServerError, fmt.Sprintf("failed to create ID token: %v", err), http.StatusInternalServerError)
|
s.logger.Errorf("password grant failed to create new ID token: %v", err)
|
||||||
|
s.tokenErrHelper(w, errServerError, "", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue