I have a HybridWebView embedded in one of the Pages of my app. If I visit a website and sign in, the HybridWebView stores the relevant information and whenever I reopen the same website I am still signed in, even after closing and reopening the app.
But when I open the same website from the same Page using await Browser.OpenAsync(Url, BrowserLaunchMode.SystemPreferred); this time I need to log in again.
Is it possible to share the session information between these 2 WebViews or better globally within the app?
At first, Browser.OpenAsync(Url, BrowserLaunchMode.SystemPreferred) will open the Browser not a WebView. You can check the official document about using browser.
And the browser is another app on the device, you can't share the cookie in your app's webview with the browser app. For more information, you can check this answer about the Android Webview private browsing.
In addition,according to this case about how to share cache including cookies between android.webkit.WebView(s), the webviews in the same android app will default share the cookies with each other.
Related
I've been trying to work out authenticating users into my app, which is running inside a MS Teams Tab application, and I'm having issues in mobile.
To authorize requests in the application, we just need to have a cookie in place that the server sets when the user authenticates. So for this to work inside Microsoft Teams, I've been trying to just send the token to the iframe and set the cookie. Everything works pretty well on web and desktop, but on mobile (I've tested only with iOS so cannot really tell about Android), the cookie doesn't work at all.
I've tried to set some test cookies and read them, and it doesn't work. So my question is if there is a way to work with cookies in mobile? Is it an issue on my end or has it been disabled in the web view that loads the tab? Is there a way around it or any suggestion that would help solve my problem?
Thanks for the help!
I've got a Xamarin Forms app running on Android and ios.
The app includes a webview. A user signs up through the webview and the web page loaded within the webview sets neccessary cookies.
When clicking on a link in the webview I want to open up the url in the in-app browser using the Xamarin.Essentials.Browser API.
And I need cookies to be shared between the webview and the in-app browser to maintain the user session.
The webview domain is domain.com/app/ and the in-app Browser url is test.domain.com/
The webview webpage is setting cookies on *.domain.com
If I open the desired page (test.domain.com/) in the webview through an iframe the page loads and the user is logged in.
When I open the page in the in-app Browser, after cookies being set inside webview, the user is not logged in.
Is there something essential about sharing cookies this way that I Am missing?
I'm working on a cross-platform wxWidgets-based application that uses a WebView for a web-based OAuth login to a web site. The web site's OAuth login process uses cookies to cache a login token once authenticated, so that you can go through the process again to get another OAuth token if necessary without the user having to enter their credentials again. The WebView backend implementation wxWEBVIEW_WEBKIT that I'm using in the macOS version of the app preserves cookies between restarts of my app and even reboots of the OS. This makes it difficult to test the login process.
Where is the WebView backend persisting these cookies? How would I go about clearing them?
I've already tried clearing the cookies in Safari to no avail, and I removed all of the obvious cache files I saw in the app's file accesses as captured by opensnoop, but the cached login is still present.
Per a response on the wx-users list, wxWEBVIEW_WEBKIT is implemented using a simple macOS WebView.
As noted in How can I remove cookies stored by WebView in Cocoa application?, in macOS 10.11 (El Capitan) and later, each application's WebViews have their own cookie storage and do not have access to each others' cookies.
I did not find a way to manually clear my application's cookies; I tried removing the relevant *.binarycookies file from ~/Library/Cookies but that had no effect. It's still unclear to me where the cookies are stored.
However I was able to delete the cookies programmatically using the NSHTTPCookieStorage API, following the code snippet in https://stackoverflow.com/a/8486398/60422. I ended up just adding a menu item for this to my application to clear the cookies that I only use for manual testing purposes.
I need to integrate google contacts import in my nw.js app. How should I create the google app ? When I create the app as web app, it asks for redirect uri which is not available for desktop apps. I'm not clear about how to implement google integration for desktop apps. Can anyone help me on this. ?
There is an option in OAuth for desktop applications, when instead of http://domain you will redirect to app://something and you application will be started or receive a callback.
To make this, in your application you need to open request token url in new window (new window in your node-webkit app).
Also: google docs and node-webkit github issue and other issue about this.
For me I thought better would be open a default browser, there is a high chance that user already authenticated, and then just need to click "allow". So I start simple webserver inside node-wekit app and redirect to localhost.
You can see implementation in my project https://github.com/Paxa/postbird/blob/90cfb53b1775310eb2f262c8b54c9dba15b5cc0a/app/heroku_client.js#L185
To open default browser I use command "open" (only for mac)
child_process.spawn('open', [url]);
I also try to close browser window when user redirected back, it works but not always.
response.writeHead(200, {"Content-Type": "text/html"});
response.end("<script type='text/javascript'>window.close();</script>");
May be I should also make a window active when receive redirect back (didn't try it yet):
var currentWin = require('gui').Window.get();
currentWin.focus();
If google not allows to make localhost as a callback url, you can try to use some domain (even free) and point it to 127.0.0.1 or use http://readme.localtest.me/
On Mac the cookies are shared between all applications, I understand that.
So if I delete cookies in my app, it will delete them in Safari, and say I delete all the google.com apps, I will find when I open Safari that I am logged out in Safari as well as the app.
However, after having deleted the cookies, I log in to Google from my app, when I open Safari I will still be logged out and have to log in there as well. So it seems cookie creation is not synchronised between apps?
But, after having deleted all the cookies again, if I log back into Google from Safari, when I open my app I will be logged in there as well, so the creation of cookies have been synced across.
Secondly if I use NSHTTPCookieStorage, to delete cookies (from within my app) the app must then be restarted before it takes effect?
What are the rules and details of how the shared cookie storage works on a Mac?