# React : How can i set prompt=none to silently redirecting the browser to the redirect Uri to avoid authentication pop up

**URL:** <https://devforum.okta.com/t/react-how-can-i-set-prompt-none-to-silently-redirecting-the-browser-to-the-redirect-uri-to-avoid-authentication-pop-up/20516>\
**Category:** Questions\
**Created:** [May 4, 2022, 1:42pm UTC](https://devforum.okta.com/t/react-how-can-i-set-prompt-none-to-silently-redirecting-the-browser-to-the-redirect-uri-to-avoid-authentication-pop-up/20516 "2022-05-04T13:42:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priyanka1](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@Priyanka1](https://devforum.okta.com/u/Priyanka1)\
**Post date:** [May 4, 2022, 1:42pm UTC](https://devforum.okta.com/t/react-how-can-i-set-prompt-none-to-silently-redirecting-the-browser-to-the-redirect-uri-to-avoid-authentication-pop-up/20516/1 "2022-05-04T13:42:50Z")

</div>

Hi,  
I am using Okta with React for authentication.  
And my login works fine.  
As i am already logged in to browser if i open different tab then user should be auto logged in as i am already authenticated.  
For this i found that i can use prompt=none in my redirect uri. How can i set this parameter, i am using oktaSignInWidget.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![ajm](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@ajm](https://devforum.okta.com/u/ajm)\
**Post date:** [May 5, 2022, 6:33pm UTC](https://devforum.okta.com/t/react-how-can-i-set-prompt-none-to-silently-redirecting-the-browser-to-the-redirect-uri-to-avoid-authentication-pop-up/20516/2 "2022-05-05T18:33:00Z")

</div>

This should work in your use case as well.

> [@SSO doesn't work when using the Okta SignIn Widget](https://devforum.okta.com/t/sso-doesnt-work-when-using-the-okta-signin-widget/8072):
>
> 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 b…

---

<div class="post-metadata">

**Author:** ![erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@erik](https://devforum.okta.com/u/erik)\
**Post date:** [May 5, 2022, 7:36pm UTC](https://devforum.okta.com/t/react-how-can-i-set-prompt-none-to-silently-redirecting-the-browser-to-the-redirect-uri-to-avoid-authentication-pop-up/20516/3 "2022-05-05T19:36:12Z")

</div>

Hi Priyanka,

When you open a new tab that application could do a [token.getWithoutPrompt(options)](https://github.com/okta/okta-auth-js#tokengetwithoutpromptoptions) using the okta-auth-js SDK.

---

<div class="post-metadata">

**Author:** ![Priyanka1](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@Priyanka1](https://devforum.okta.com/u/Priyanka1)\
**Post date:** [May 13, 2022, 3:18pm UTC](https://devforum.okta.com/t/react-how-can-i-set-prompt-none-to-silently-redirecting-the-browser-to-the-redirect-uri-to-avoid-authentication-pop-up/20516/4 "2022-05-13T15:18:17Z")

</div>

@ajm @erik ,

In order to implement single session per user across the browser, i am planning to do following things -

1. The idea is to redirect from [[http://localhost:300](http://localhost:300)](the root URL) to [https://xxxx/oauth2/default/v1/authorize?response\_type=code&prompt=none&client\_id=xxxxx&scope=](https://xxxx/oauth2/default/v1/authorize?response_type=code&prompt=none&client_id=xxxxx&scope=)…&nonce=…&state=…&redirect\_uri=http://localhost:3000/login/callback (insert scope, nonce and state parameters as required)
2. Okta will then check for a valid session and redirect the user back to /login/callback
3. If the user has a valid session, the response will be an authorization code and session can continue
4. if the user does NOT have a valid session, Okta will send an error and /login/callback should instead redirect to /login to show the login prompt.

Any lead for above steps implementation would be really helpful. Could you help.  
I am using Okta with react.

I found below sample code from Okta Auth JS SDK. I need to provide sessionToken,state,nonce,ldp, from where i can find all these details for my application.

authClient.token.getWithoutPrompt({  
sessionToken: ‘00p8RhRDCh\_8NxIin-wtF5M6ofFtRhfKWGBAbd2WmE’,  
scopes: [  
‘openid’,  
‘email’,  
‘profile’  
],  
state: ‘8rFxxxH5q’,  
nonce: ‘xxxTswrm’,  
// Use a custom IdP for social authentication  
idp: ‘xxxxxc8PaGpU0h7’  
})  
.then(function(res) {  
var tokens = res.tokens;

// Do something with tokens, such as  
authClient.tokenManager.setTokens(tokens);  
})  
.catch(function(err) {  
// handle OAuthError or AuthSdkError  
});

---

<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, 2024, 7:34pm UTC](https://devforum.okta.com/t/react-how-can-i-set-prompt-none-to-silently-redirecting-the-browser-to-the-redirect-uri-to-avoid-authentication-pop-up/20516/5 "2024-02-12T19:34:20Z")

</div>

Closed on February 12, 2024, 7:34pm UTC


