Closed punmechanic closed 2 days ago
Users may encounter the following error when retrieving session keys using KeyConjurer:
Error: failed to fetch SAML assertion
This error arises because:
keyconjurer accounts
.keyconjurer get [account name of new application]
.Error Handling in Token Exchange Endpoint:
ErrUnauthorized
error if a failure occurs during the token exchange process.Implementation:
ErrUnauthorized
error.This approach ensures that users receive clear and actionable error messages when the token exchange fails.
Description
A user who attempts to retrieve session keys using
keyconjurer get
may receive the error:Reproduction steps
keyconjurer accounts
.keyconjurer get [account name of new application]
.Okta may reject a request to exchange tokens using token exchange flow. If it does, the error is silently dropped, and the code continues, ultimately submitting an empty Oauth2 token to the SAML assertion endpoint, which results in the above error.
Resolution
Return an
ErrUnauthorized
error to the end-user if this occurs during the token exchange endpoint. It's not clear if the response code from Okta is HTTP 500, HTTP 403 or simply a non-200 HTTP response code; Standards indicate that the response code should be HTTP 400. We will simply treat any non-200 status code as an unauthorized error.