How to implement initiate login URI flow using embedded sign-in widget

Hi All. I’m trying to login the user directly into our app (React) when user clicks the app icon from Okta dashboard. This is working fine when we use Okta-hosted sign-in widget but how to achieve the same with embedded Okta sign-in widget. Thanks

An embedded widget isn’t designed to automatically detect an existing Okta session. Depending on your environment, you have two options

  1. When user reaches your application via the dashboard tile, check if an Okta session exists in their browser (GET /api/v1/sessions/me) and/or immediately try to use their existing Okta session to get tokens with getWithoutPrompt().
  2. As the above may not work on certain browsers due to their third party cookie policies (I believe Safari specifically doesn’t support accessing 3rd party cookies from within an iframe, as is used by this method), you would instead have to generate your own /authorize request from your application to log the user in (e.g. using getWithRedirect()).
    a. One pretty basic way to do it is to create a specific route in your application to immediately kick-off the OAuth flow and have your dashboard tile redirect the user there (if this is just in a custom OIDC app, that would be your Initiate Login URI). If this route only exists for this redirect, its safe to assume the user already has an existing Okta session and to just trigger the, but as we all know, usage by actual end-users can vary, so its possible they may wind up bookmarking that URL for all we know.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.