-
Notifications
You must be signed in to change notification settings - Fork 232
Confused? Is Okta auth in Android apps shareable with webviews? #877
Comments
@bdruth - Thanks for the question, I'll forward this to team members that can speak intelligently about react-native and see if we can get you an answer. |
@bdruth Webview is not the recommended way to implement OIDC flow in the native app.
For the
|
OK - that jives with some of the things I've read. What I'm not clear on is what to do with the acquired token so that there's a seamless SSO? I'm not married to using webviews, and I've read that Chrome Custom Tabs on Android might be the better option, though it's bizarre that those are two completely different things in react-native, and the cross-platform behavior is completely different for Chrome Custom Tabs ... ideally there'd be a simple way to use webviews on iOS and Chrome Custom Tabs on Android in an effectively identical way from React Native, but I digress ... |
@bdruth The |
Right ... but I need custom sign-in. So, how do I use custom sign-in and pass what to a Chrome Custom Tab? |
For custom signin in react native you will need to build your own sign in UI, instead of using custom tabs to open the okta login page. https://github.com/okta/okta-react-native#custom-sign-in |
Right - I'm following all that. I have the |
@bdruth If I understand your question correctly. You want to implement the SSO as the app redirects the user to a webpage (OKTA domain) to start the sign in process, then it redirects user back to the app after success sign in. Or you want to customize any step in the browser sign in flow? |
No, that's not correct. We're looking at how we would have a native app, with native (custom sign-in flow), that will have native functionality in hybrid with loading web pages from existing / legacy secured systems. Both are setup in Okta using OIDC (there may be future need for SAML, too, but right now our test bed is using OIDC). Current behavior is:
desired behavior is:
This is working in iOS using the |
Hi @bdruth, The android native sdk needs to have webview support. I have an experimental branch with this webview but this is not something we are planning to support. If you like I can share the patch with you. |
@FeiChen-okta - feel free to share patch. So, if I'm understanding correctly, the only way to have SSO between native & web content on Android is to use the |
Hi @bdruth We have a couple of different configurations
You can apply the following patch to the master branch in https://github.com/okta/okta-oidc-android |
@FeiChen-okta thank you! So, I'm assuming I need to actually call
|
Hi @bdruth Currently the react-native SDK does not support a way to get the headers from the Android bridge. So you'll need a way to get the response header from HttpClientImpl.java to react-native layer and set the cookies in Or the other way around where react-native set a boolean flag similar to iOS After these changes |
K, I'll take a look and see what I can come up with. Thanks much for your assistance thus far! |
@bdruth I am facing the same issue now. Have you workaround this? Tks |
I'm submitting this issue for the package(s):
I'm submitting a:
Current behavior
I'm new to Okta and trying to navigate the best way to incorporate Okta authentication in native apps (iOS/Android) to SSO with webviews opened by these apps to apps protected by the same Okta domain. I've been able to get this working in iOS using the
custom-sign-in
example in https://github.com/okta/samples-js-react-native and the information to setupusePersistentCookie
. On Android, however, I'm not connecting the dots. Is this possible? I've seen an issue reference Chrome Custom Tabs and how cookies can't be shared to a webview from there, but it doesn't look like thecustom-sign-in
example uses that on Android. Thebrowser-sign-in
example is documented as returning a code to the app which is then exchanged for an access token and id token, so it doesn't appear that there's any cookie being set that a webview could inherit in this approach, either?Expected behavior
Both Android and iOS platforms have an Okta SSO mechanism to embedded webviews from the native application.
Minimal reproduction of the problem with instructions
Run https://github.com/okta/samples-js-react-native apps on Android and use a webview (e.g. https://github.com/react-native-community/react-native-webview) to load an Okta web app protected in the same domain - should work w/o prompting for login again.
Extra information about the use case/user story you are trying to implement
Implement a hybrid native app with some native functionality and some webview functionality under the same Okta domain without requiring multiple logins on Android.
Environment
node -v
): 12.6.3The text was updated successfully, but these errors were encountered: