# SSO doesn't work when using the Okta SignIn Widget

**URL:** <https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072>\
**Category:** Questions\
**Tags:** widget, react\
**Created:** [February 12, 2020, 3:42pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072 "2020-02-12T15:42:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcspratt](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/marcspratt/32/1634_2.png) [@marcspratt](https://devforum.okta.com/u/marcspratt)\
**Post date:** [February 12, 2020, 3:42pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/1 "2020-02-12T15:42:00Z")

</div>

When logging in using the okta-signin-widget (I’m using it with okta-react), SSO does not work across other apps also using the widget. I’m logged into Okta, if I navigate to the Okta developer dashboard, but not my other apps which use the widget as well.

I’ve narrowed this issue down to the logic around the method .isAuthenticated() inside okta-react/src/Auth.js. This method only checks if either the access or id token exist in client storage, not also if a session exists in Okta. Is this a bug, or is it intentional?

Would it make sense to add a storage option such as ‘okta’ alongside ‘localStorage’, ‘sessionStorage’, and ‘cookie’, which forces the client to always call to check if the user is signed in and not rely on client storage at all?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 12, 2020, 4:55pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/2 "2020-02-12T16:55:30Z")

</div>

You’re correct, in that the React SDK is ensuring that a user has been authorized into the accessed application via JWT tokens, but SSO across applications means that each application will need to make an /authorize call to get these tokens to allow the user to access protected routes.

Your applications can do this when the user accesses it without prompting the user, if they have an active Okta session, by using getWithoutPrompt]([https://github.com/okta/okta-auth-js#tokengetwithoutpromptoauthoptions](https://github.com/okta/okta-auth-js#tokengetwithoutpromptoauthoptions))

---

<div class="post-metadata">

**Author:** ![marcspratt](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/marcspratt/32/1634_2.png) [@marcspratt](https://devforum.okta.com/u/marcspratt)\
**Post date:** [February 12, 2020, 6:18pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/3 "2020-02-12T18:18:03Z")

</div>

How could I leverage this without hacking the libraries?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 14, 2020, 8:51pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/4 "2020-02-14T20:51:50Z")

</div>

You can just make the /authorize request yourself with the parameter [prompt=none](https://developer.okta.com/docs/reference/api/oidc/#request-parameters), which will automatically redirect the user to the login redirect\_uri, provided the user has an active Okta session.

---

<div class="post-metadata">

**Author:** ![nderman](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@nderman](https://devforum.okta.com/u/nderman)\
**Post date:** [March 23, 2020, 10:20am UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/5 "2020-03-23T10:20:11Z")

</div>

> [@andrea](#):
>
> authorize

Could you give more detail on this? I’m trying to achieve the same thing

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [April 20, 2020, 3:27pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/6 "2020-04-20T15:27:15Z")

</div>

I was referring to one of the parameters when making a call to the /authorize endpoint, as covered here: [https://developer.okta.com/docs/reference/api/oidc/#parameter-details](https://developer.okta.com/docs/reference/api/oidc/#parameter-details)

‘prompt’ is an optional parameter that allows you to control whether or not a user is prompted for their password. The JS SDK’s use this parameter for methods like the aforementioned getWithoutPrompt to control whether or not the user is shown a login prompt. Note that if the user does NOT have an active Okta session (which you can confirm via a [/sessions/me](https://developer.okta.com/docs/reference/api/sessions/#get-current-session) check), an error will be returned.

---

<div class="post-metadata">

**Author:** ![ahuang](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@ahuang](https://devforum.okta.com/u/ahuang)\
**Post date:** [November 12, 2020, 5:38am UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/7 "2020-11-12T05:38:27Z")

</div>

I am facing the issue too. And I tried to call /authorize with many url params after redirect to react app.

But it needs nonce value. When click the app icon from Okta, it will redirect to the custom portal page with one parameter on url is “iss”, and value is our org domain. It seems I should get some key values when redirect from okta to custom react app, but not.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [November 12, 2020, 4:33pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/8 "2020-11-12T16:33:09Z")

</div>

Okta will only redirect users to the configured “Initiate Login URI” for your application if you are using the OIDC Compliant setting for your application.

 ![Screen Shot 2020-11-12 at 8.30.42 AM](https://global.discourse-cdn.com/oktadev/original/2X/c/ce862d77d2495138f1e23c71c250c8524efd7b72.png)

This means that your application will need to detect the Okta session and kick off the authorize call once the user lands on your login page. Okta will only make the call for you if you choose the Okta Simplified option.

---

<div class="post-metadata">

**Author:** ![ahuang](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@ahuang](https://devforum.okta.com/u/ahuang)\
**Post date:** [November 12, 2020, 4:57pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/9 "2020-11-12T16:57:16Z")

</div>

Yes, my problem is how to detect Okta session? when redirect to my application, it does not carry/pass any cookies or useful information to my application.

Currently, I put a dedicated URL to allow redirect. After redirect to my dedicated URL, I will make /authorize call with several parameters, but it requires some values like “nonce”, “state”… I do not have those values.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [November 17, 2020, 5:33pm UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/10 "2020-11-17T17:33:59Z")

</div>

You can detect the user’s session by making a CORS request to Okta. You can either [make this request manually](https://developer.okta.com/docs/reference/api/sessions/#get-current-session) or you can use our Auth JS SDK (especially if your application already uses it) to [determine if the user has an active session](https://github.com/okta/okta-auth-js#sessionexists). Note that this call will fail if the user’s browser is blocking third party cookies and you are not using a Custom URL Domain. More information [here](https://support.okta.com/help/s/article/FAQ-How-Blocking-Third-Party-Cookies-Can-Potentially-Impact-Your-Okta-Environment).

Like I said, you will want to redirect to a login page, as the URL you set as the Initiate Login URI will be static and its not recommended to have static values for state (our SDKs generate these values for you). Then your application can make the /authorize request. Again, if you are using our Auth JS SDK, you can use [getWithoutPrompt](https://github.com/okta/okta-auth-js#tokengetwithoutpromptoptions) or [getWithRedirect](https://github.com/okta/okta-auth-js#tokengetwithredirectoptions) to do so automatically if the sessions.exists().

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [November 20, 2020, 1:25am UTC](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072/11 "2020-11-20T01:25:37Z")

</div>

Closed on November 20, 2020, 1:25am UTC

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