okta-react-native icon indicating copy to clipboard operation
okta-react-native copied to clipboard

[Android] signInWithBrowser (Social Sign In)

Open Qwin opened this issue 3 years ago • 7 comments

Hi Okta team,

So when using signInWithBrowser on Android is there a way to clear the session completely when logging out ? currently when logging out there is no way for me log out from (Facebook, gmail etc) when I try to login again it automatically logs me in unless I go to my chrome browser and sign me manually out from the service I am using (for instance google).

let me know if there is a workaround. On iOS it works fine. We are using okta-react-native 2.2.0, react-native 0.65.1.

Thanks,

Qwin avatar Jan 25 '22 21:01 Qwin

hi @Qwin I'll see if I can run down an answer for you.

monde avatar Jan 25 '22 23:01 monde

Hi @Qwin have you taken a look at the signOut method? https://github.com/okta/okta-react-native#signout

This should launch the browser (very briefly), and log you out of Okta from the browser side as well. Next time you try to log in, you should be presented with the Okta Sign In Widget to choose your login method (username/password, facebook, google, etc)

JayNewstrom avatar Jan 26 '22 00:01 JayNewstrom

@JayNewstrom I see it opening the browser briefly, yet when I try to re-login, it still logs me in automatically, on iOS it does not.

Qwin avatar Jan 26 '22 14:01 Qwin

Can you share a code snippet of how you're logging in?

JayNewstrom avatar Jan 26 '22 15:01 JayNewstrom

@JayNewstrom will try to get you something tomorrow

Qwin avatar Jan 27 '22 04:01 Qwin

I am also facing same issue.

rajkshah14 avatar Feb 06 '22 16:02 rajkshah14

we are facing the same issue, we are trying to clear if any previous session exists but it is not working as expected all the time. sometimes it is stucking at signout call. please help us


import {
  EventEmitter,
  createConfig,
  getUser,
  isAuthenticated,
  signOut,
  signInWithBrowser,
  clearTokens,
} from '@okta/okta-react-native';
...
....

const oldOktaSession = await isAuthenticated();
if (oldOktaSession?.authenticated) {
     await signOut().catch((e) => log.error(e));
}
await clearTokens().catch((e) => log.error(e));
await signInWithBrowser({noSSO: true});
...
...

satya-imaginea avatar Mar 24 '22 13:03 satya-imaginea