pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.26k stars 1.6k forks source link

iOS cookie session not save when closing the app (http website) #824

Closed nongtiny closed 3 years ago

nongtiny commented 3 years ago

Environment

Technology Version
Flutter version 2.0.3
Plugin version 5.3.0
Android version
iOS version 14.4
Xcode version 2373

Device information: Iphone 11

Description

Test URL: http://188.34.156.6:37892/login/

Expected behavior:

When the user log in successfully, the website will set the login session cookie, and when the user closes the app. The user doesn't need to log in again. The session should still be there.

Current behavior:

When the user does login successfully, the website will set the login session cookie, and when the user closes the app. The user needs to log in again. The session is gone.

Steps to reproduce

  1. Open the app with InAppWebView widget with initialUrl = http://188.34.156.6:37892/login/
  2. Log in ( Sorry. I can't give you the credential )
  3. Terminate the app and open it again
github-actions[bot] commented 3 years ago

👋 @nongtiny

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

nongtiny commented 3 years ago

I already searched and found it, but I still can't solve it.

Is it because the website is http? I tried on https website. It works.

Can we do something to handle the website that has only http?

Thanks in advance.

nongtiny commented 3 years ago

I found the issue now. If the website cookie is not set the expiration date the cookie will be lost when terminating the app.

This happens only in iOS. Now, I'm just a newbie in mobile application development. I don't know the real problem, but this works for me. If you have an answer to this. I would like to hear it.

Anyway, thanks for developing this brilliant package.

NickB23 commented 3 years ago

@nongtiny Thank you so much for this mention. I was searching for hours until I stumbled upon your comment. Saved my day!

github-actions[bot] commented 1 week ago

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.