New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve IdP Discovery interface when acting as OIDC client #566

nbarbettini opened this Issue Oct 19, 2018 · 1 comment


None yet
3 participants
Copy link

nbarbettini commented Oct 19, 2018

I'm submitting a

  • feature request

Background info

Given this configuration:

var signIn = new OktaSignIn({
  el: "#widget",
  baseUrl: 'https://{yourOktaDomain}',
  idpDiscovery: {
    requestContext: '/a/app/request/context',
  features: {
    idpDiscovery: true
  function (res) {
    if (res.status === 'IDP_DISCOVERY') {
      // idpDiscovery.redirectToIdp knows the authentication URL for the selected IdP.
      // This will redirect to that authentication URL, and include someUri as a query param: ?fromURI={someUri}

The Sign-in Widget will query Okta (IdP Discovery) to determine whether it should redirect to another IdP to sign the user in.

Feature gap

If the Widget is self-hosted by an application and is acting as a client (i.e., configured with a client ID), and the intent is to get tokens from Okta and return to the application with these tokens, the redirectToIdP method is not quite sufficient.

There is no way to tell the Widget and server: redirect to the target IdP to sign the user in, and afterward get tokens and return them to my application.

More background here:


Add a method like res.idpDiscovery.continueAndGetTokens()


  1. Construct an authorize URL following the logic in Auth.js getWithRedirect
  2. Drop the expected cookies in the browser, following the logic in Auth.js getWithRedirect
  3. Behave like redirectToIdp with the authorize URL from (1)

continueAndGetTokens can be thought of as a special case of redirectToIdp that understands how to construct the correct redirect authorize URI (and sets the correct cookies). We may be able to simply use Auth.js to do this with the existing getWithRedirect method.

This is very similar to what the Widget does for social login:


This comment has been minimized.

Copy link
Contributor Author

nbarbettini commented Nov 16, 2018

Holding pending the outcome of this discussion:

Update: this fix can proceed. Future changes (in a major version bump) may also solve the problem.

@jmelberg-okta jmelberg-okta removed their assignment Dec 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment