Native app SSO to Webview (Web Application)

Hello, everyone,

I have Mobile app(android), and web application.
I have SSO in Mobile app, but I cannot share the session with “web application”
I dont know how to implement the pkce flow with “WebView” in kotlin.
(We are loading our web application with "webview.loadurl(https://site.com) )

I have tried in many ways. Like…

  1. in MainActivity file : cookieManager.setAcceptThirdPartyCookies(view, true)
  2. I made react native app, and in app.tsx file, I load our site with react-native-webview
    <WebView source={{uri : ‘https://site.com’}} sharedCookiesEnabled=true/>
    but anything is not working.

Thanks for any help.

  • I tried to use chromeCustomTab, but we cannot control the cookie of the customTab which I can auto login after I logout with loggout app.
    That’s why we want to use “Webview” but, I really dont know how to share the session from android app to my web application.

I solved this problem.
in MainActivity, you can inject javascript with token.

var localStorageScript = “localStorage.setItem(‘okta-token-storage’, '{"accessToken": {"accessToken" : "” + accessToken + “"}, "refreshToken": {"refreshToken" : "” + refreshToken + “"},"idToken": {"idToken" : "” + idToken + “"}}');”

webview.evaluateJavascript(localStorageScript, null)

Good luck.