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:
Márk Sági-Kazár 2021-10-21 17:42:33 +02:00 committed by GitHub
commit 18311aa44d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1106,10 +1106,17 @@ func (s *Server) handlePasswordGrant(w http.ResponseWriter, r *http.Request, cli
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)
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
}