4

How to authenticate an Okta user via Cognito in a custom login page, i.e., without redirecting the user to Cognito's hosted UI?

I've performed these steps to successfully "set up Okta as a SAML identity provider with an Amazon Cognito user pool". My Angular app now redirects to Cognito's hosted UI to log the user in, which in-turn redirects to Okta where the user enters their credentials. After a successful login, control returns to my app with the ID & access tokens in the URL.

I've seen this question but it too talks about redirecting the user to the IdP login page.

I'm looking for code like this or this but instead of providing the Cognito user's username & password, I need to provide the Okta user's credentials.

The desired result is to have a login behavior exactly like this, wherein the user never leaves the app. The only difference is that the credentials that the user enters are stored in Okta, not in Cognito.

1 Answer 1

3

When you have a third-party provider as an Identity Provider with Amazon Cognito, the Authentication on the third-party end would be handled by the third-party only, and Cognito would just re-direct to the third-party, and have a handshaking process with the IdP. After successful handshakes and validations, Cognito returns JWT Tokens.

However, Cognito does never have access to the credentials/details entered in the third-party, to increase security of the Authentication Engine. Hence, there are no API calls in which you could enter your IdP's credentials to log into your Cognito User Pool, as that would essentially be a breach in Cognito's security.

1
  • What about if you already authenticated with the third-party via the third party's API? How do you pass those token to Cognito the way the handshake would have?
    – kravb
    Jul 12, 2023 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.