-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
iOS cookie fails to reload or restore when reopening the app | Only for specific sites #510
Comments
Maybe an SSL tls version or something on the server end? I have some joomla websites that the ios issue is not present and some where the issue is present. However i cannot find the difference 2 are practically identical where 1 works and the other does not. Any clues to where I should look? Same 3 default joomla cookies are set so its not the cookies. |
Also having this problem. Have the same app on Android/iOS. Android works perfectly, iOS treats each session as new |
After looking through the code, this fixed it for me: I had sharedCookiesEnabled set to true, and incognito to false. In the code, if that combination is true, it uses a nonPersistent session type which is a bit confusing, which caused the session to not persist. Setting sharedCookiesEnabled to false and incognito to false fixed this for me on iOS. |
@scottk Your suggestion did not work in this case, the shared cookies work with known websites such as twitter ect on ios. It is only with some sites, even when comparing some of my servers running nginx vs openlitespeed it is hard to find the cause. 2 instances running openlitespeed show one working and the other not persisting sessions. Any hints to possible cause such as ciphers ect. please share. I will continue to solve this mystery |
Me too. |
@khacnha your issue seems related to app state/cache that resets when system parameter is changes. Try the "Device -> Erase all content and settings" on the simulator and test your app from scratch. I solved my mystery however!! It appears a redirect if statement on my php end of joomla causes the iOS cookies to not get fetched correctly when reopening the app. I have no clue how that can be the culprit, nor how to keep both my redirect active to maintain cookie functionality. Possibly force an "await" for the cookies if possible could solve something however I am going to find an alternative solution for my redirect in the mean time. If someone ever comes up with a solution to enforce cookies being fetched until finished please post here. |
i have the same issue with v4.0.4, i have been reverting to version 3.3.0 for iOS and now it's working correclty. |
@breebee did get the solution I also have a similar problem, |
Yes, the cookie issue on my end was due to redirects for the app which must have lost the session or something in the process. iOS and android both handle cookies correctly with inappwebview, you must find the point where your code is different in dev to prod. *** Make sure you clear everything "Device -> Erase all content and settings" on the simulator and test your app from scratch. When making changes, I found this to be an issue when testing changes to find the main cause. |
i had to switch to use flutter webview and it working: https://pub.dev/packages/webview_flutter I think it's a potential error, not the way we set cookies. Since I have tried many ways from setting cookies with javascript to setting cookies on php, all of them failed in ios |
@khacnha if you want me to give a look, send me the url and test credentials to see if i can persist the cookie on ios for you from the inappwebview side if your convinced it is not from your server. |
@breebee This is url demo: http://mutu.vietprojectgroup.com/webview/search |
@khacnha works for me dude. I close app, reopen works, switching urls works, power off phone and restart app works. using iphone 8 (13.4.1) initialOptions: InAppWebViewGroupOptions( [✓] Flutter (Channel dev, 1.23.0-13.0.pre, on Mac OS X 10.15.6 **** x86_64, locale en-US) [!] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 11.4.1) [!] Android Studio (not installed) [✓] IntelliJ IDEA Community Edition (version 2020.2.3) [✓] Connected device (2 available) ! Doctor found issues in 2 categories. |
I'm facing the same problem on a real device... Anyone found a solution ? |
@jreliberty me too! Did you find any solution to this? I have this website for which the Safari browser doesn't keep the session. So, I log in, close Safari and reopen it, and I'm not logged in. :/ On android (Chrome browser) it works. As I see that your plugin is very rich in features, I thought you can tell me if I can get the webview to preserve session when I close and reopen my app. Or at least give me advice in which direction I should research, if you know of course. Thanks, to both of you! P.S. |
Hey man, hope u doing great I have the same issue you had before would pls help me solve it here's my code //void main() => runApp(const MaterialApp(home: MyHomePage())); if (Platform.isAndroid) {
} runApp(const MaterialApp( class MyHomePage extends StatefulWidget { @OverRide class _MyHomePageState extends State { Future readData() async {
} late bool _serviceEnabled;
// ignore: non_constant_identifier_names late PullToRefreshController pullToRefreshController; @OverRide
} getData() async { @OverRide
} Future firstCheck() async { @OverRide
} class notificationWidget { static Future init({bool scheduled = false}) async { static Future shownotification( static notificationDetails() async { |
Would u pls help me |
@breebee Would u pls help me |
@Abdallah-El-Feky first check if cookies work on other sites to determine if the issue is on your servers end |
Seems to be still happening |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue. |
Environment
Device information:
Description
Expected behavior:
It is expected when logged into a webview using the cookie manager all webviews across the app are logged in sharing cookies. Reopening the app after closing it should restore cookies and sessions.
Current behavior:
Only on iOS everything works in sync but when you close the app and re open it, it fails to reload/restore the cookies and sessions. Android does not seem to face this issue.
Steps to reproduce
Use a websites url's for the webviews with a site who may have too many cookies / malformatted cookies which may cause ios to get stuck / timeout when restoring/reopening the app.
The text was updated successfully, but these errors were encountered: