Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple sessions #371

Closed
owenkealey opened this issue Jun 2, 2020 · 9 comments
Closed

Multiple sessions #371

owenkealey opened this issue Jun 2, 2020 · 9 comments

Comments

@owenkealey
Copy link

Hi,

My goal is to have multiple inappwebview sessions in my app so that they each have their own state and do not share anything. I tried using UniqueKeys to distinguish between web views but it seems the cookies on the first web view are being used by the second web view. Any guidance on how to fix this?

@pichillilorenzo
Copy link
Owner

I made some research to check if it is possible to do this in Android, but it seems not possible. The problem is not related to any Flutter API, such as UniqueKeys. Probably it is related to how Android manage cookies for all the WebViews.

@owenkealey
Copy link
Author

owenkealey commented Jun 2, 2020 via email

@owenkealey
Copy link
Author

I can do this with multiple WKWebView instances in Swift so I am wondering if it was possible with this plugin

@pichillilorenzo
Copy link
Owner

Ok, I found a bug in my code for the iOS platform. I was setting some WKWebView configurations too late. This will be fixed in the next release!

It seems that to have multiple sessions on iOS, I need to use configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent() for each WKWebView you want to have without sharing cookies.
This is done through the incognito: true option.

Now incognito option is broken on iOS, but I'm going to fix it right now.

@owenkealey
Copy link
Author

owenkealey commented Jun 2, 2020 via email

@pichillilorenzo pichillilorenzo changed the title Multiple sessions Multiple sessions on iOS Jun 2, 2020
@pichillilorenzo pichillilorenzo changed the title Multiple sessions on iOS Multiple sessions Jun 2, 2020
@pichillilorenzo
Copy link
Owner

New version 3.3.0+3 released!

This was referenced Jul 6, 2020
@shimorojune
Copy link

I am facing the same problem dealt with @owenkealey here.

The cookies are not stored only when there is an incognito version is present, which I believe would mean that maybe that feature is causing the problem.

I have tried the same code sample provided by @pichillilorenzo in this page. The same Gmail example provided, does not always persist the data all the time.
You can even try using other OAuth enabled sites such as Medium.com or similar.

@pichillilorenzo Could you please look into this?

@shimorojune
Copy link

@pichillilorenzo @owenkealey
I experimented around a bit, and found that while in incognito mode, the cookies for example are wiped clean to default state, the cookies are not filled with the default values once the incognito mode is turned off.
What could be the reason for this?

@sarthak13gupta
Copy link

sarthak13gupta commented Feb 3, 2023

I made some research to check if it is possible to do this in Android, but it seems not possible. The problem is not related to any Flutter API, such as UniqueKeys. Probably it is related to how Android manage cookies for all the WebViews.

Hi @pichillilorenzo , is it still not possible to have multiple inappwebview sessions without sharing state or anything ?
I'm making a dapp wherein i have to connect with the same web3 site on two different webviews but with different wallets .... can u help me with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants