We use Meteor login system. We link to our website from the app for some functionality, but when the user goes to this webview he has to log in again. This is quite a hassle for the user.
What we’d like to do instead is auto log him in. Meteor uses the browser’s local storage to do the login. If we can set the localstorage from the app when opening the webview he’ll be autologged in. I’m not sure this possible to do, but if it is I would love to know how.
If there’s another way to communicate with the webview that’s opened that would also be great.
One solution I can think of is sticking the login token in the url for the user and then place that into localstorage when the page loads although I’m not sure if that’s a security best practice to have the login token in the url.
Any help would be appreciated here.
do you use the
WebView component or the
WebBrowser, but happy to switch.
Ah I see it’s very doable with
WebView. Is that what we should use?
Would you recommend using
are you testing this with ios11 or some other os? on ios11 to maintain the session you should use
WebBrowser.openAuthSessionAsync – https://docs.expo.io/versions/latest/sdk/webbrowser.html#expowebbrowseropenauthsessionasyncurl-redirecturl
I don’t think this is what we’re looking for. I want to send a user to our
actual site to do things. He’s already logged into the app. I just don’t
want him to login again which is what is currently happening.
Can you answer the question about the OS though? It is relevant
another solution would be to just pass some token through the url, and have some code on your web side that initializes state based off of that
It would be for all popular os versions. Android and iOS
i ask because SFSafariViewController doesn’t maintain cookies by default on ios11+. anyhow i think the solution i suggested of injecting data in url should do the trick just fine
I have a similar use case & am looking into using
WebView for this since it allows me to manipulate cookies. However I like using
WebBrowser & would love to see this added as a feature. (Having the ability to manipulate cookies)
Could you please add this to our canny: Feature Requests | Expo it would be super helpful as we work on adding features!