Both ORG 1 and ORG 2 have singin redirect as /okta/login/callback. But on idp discovery the callback is https%3A%2F%2Fmy-first-org.okta.com%2Foauth2%2Fv1%2Fauthorize%2Fcallback instead of what defined in both orgs.
If I manually change url to ../okta/login/callback - it works and I am able to sign as ORG 2 user. On the way back to my ORG 1 widget - I have token error- I assume due to redirect_uri being incorrect?
I don’t understand, it sounds like the issue you’re running into is related to logging into an OIDC application not an OIDC Identity Provider
When Okta makes a request to log a user in via an OIDC Identity Providers, it will be handling the tokens being returned by that provider, so the redirect_uri will be a callback endpoint for the target Okta Org itself, either https://company.okta.com/oauth2/v1/authorize/callback (if using the *.okta.com domain to login) or https://{{customDomain}}/oauth2/v1/authorize/callback (if using a Custom Domain). That way Okta can validate the tokens returned by the IdP and create an Okta session for the user.
–
How is your application triggering this request? Do you happen to be using a Widget with useClassicEngine set to true (or using a widget v6.x or lower)?
ORG 2 error with redirect_uri=https://org1.okta.com/oauth2/v1/authorize/callback when I manually change to redirect_uri=http://localhost:3000/okta/login/callback - it works, but after login into ORG2 I being send back to my app http://localhost:3000/okta/login/callback but getting error with token expired in the system log for ORG 1
Just to confirm, in your widget configuration, is it currently set up to point to Org 1 (in which there is an external IdP for Org 2)? E.g, the issuer URL and clientId are from Org 1?
Does login work if users log into Org 1 directly (without attempting to then route them to a target application)? You can test the IdP itself using a URL like this: https://OktaDomain/sso/idps/idpId, replacing OktaDomain with the URL for Org 1 and idpId with the ID of the Identity Provider created in Org 1 that points to Org 2.