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

Sessions are not saved #573

Open
MakiK777 opened this issue Jul 24, 2020 · 6 comments
Open

Sessions are not saved #573

MakiK777 opened this issue Jul 24, 2020 · 6 comments

Comments

@MakiK777
Copy link

After logging in to a site, I restart the application, it will be logged out.
When I checked the corresponding page from the web browser, I found that the session ID was issued, and that this controls the login status.
The email address you used to log in remains in the input field on the login page, so it seems that cookies are saved but sessions are not saved.
It only happens on iOS. (Login is maintained on Android)
Since the connection destination is an external site, I cannot edit the web page.
Are there any measures?

Unity 2019.4.2f1
iPhone7(iOS 13.0), iPhoneXS(iOS13.4)

@KojiNakamaru
Copy link
Member

The email address you described might be stored not as cookies but in local storage, thus might work without any issue. WKWebView caches cookies on memory and doesn't guarantee to save them, so I added experimental SaveCookies() in #561. Though I've not tested the code, could you please try it?

@MakiK777
Copy link
Author

Thank you for your reply.
I tried SaveCookies(), but the results have not changed.

I also tried Debug.Log( webView.GetCookies("https://~~~/") );.
Then, cookies are stored, but the session is not included.

@KojiNakamaru
Copy link
Member

Hmm, how about Debug.Log( webView.GetCookies("https://~~~/") ) for android? Could you please provide the output for both platform (of course please hide security information with asterisks)?

@MakiK777
Copy link
Author

iOS

_ga=GA1.3.828811705.***; Domain=.example.co.jp; Path=/; Expires=Wed, 27 Jul 2022 13:22:46 GMT+9; Version=0
_gid=GA1.3.726318346.***; Domain=.example.co.jp; Path=/; Expires=Tue, 28 Jul 2020 13:22:46 GMT+9; Version=0
MB_MRXXANSY=6b6f***; Domain=www.example.co.jp; Path=/; Expires=Wed, 26 Aug 2020 13:22:12 GMT+9; Version=0
SERVICENAME_CUST[login_customer_name01]=***; Domain=www.example.co.jp; Path=/; Expires=Wed, 26 Aug 2020 13:22:12 GMT+9; Version=0
SERVICENAME_CUST[login_customer_point]=0; Domain=www.example.co.jp; Path=/; Expires=Wed, 26 Aug 2020 13:22:12 GMT+9; Version=0
R_CUSTOMER=6b6f***; Domain=www.example.co.jp; Path=/; Expires=Wed, 26 Aug 2020 13:22:12 GMT+9; Version=0
_rt.uid=6b6f***; Domain=.example.co.jp; Path=/; Expires=Thu, 28 Jul 2022 13:22:31 GMT+9; Version=0
_rt.xd=1a30***; Domain=.example.co.jp; Path=/; Expires=Tue, 28 Jul 2020 12:22:31 GMT+9; Version=0
SERVICENAME_id=***%40gmail.com; Domain=www.example.co.jp; Path=/; Expires=Tue, 27 Jul 2021 13:22:25 GMT+9; Version=0
SERVICENAME_CHECK_NEWS=1; Domain=www.example.co.jp; Path=/; Expires=Mon, 27 Jul 2020 14:21:46 GMT+9; Version=0
SERVICENAME_CHECK_NEWS_SP=1; Domain=www.example.co.jp; Path=/; Expires=Mon, 27 Jul 2020 14:21:46 GMT+9; Version=0
SERVICENAME_CHECK_SHOP=1; Domain=www.example.co.jp; Path=/; Expires=Mon, 27 Jul 2020 14:21:46 GMT+9; Version=0
SERVICENAME_CS_CHECK_NEWS=1; Domain=www.example.co.jp; Path=/; Expires=Mon, 27 Jul 2020 14:21:46 GMT+9; Version=0
WebViewController:Start()
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

Android

_ga=GA1.3.483230703.***;
ECSESSID=***;
SERVICENAME_CUST[login_customer_name01]=***;
SERVICENAME_CUST[login_customer_point]=0;
R_CUSTOMER=d6c8f***;
MB_MRXXANSY=d6c8***;
_rt.uid=d6c8***;
SERVICENAME_CHECK_NEWS=1;
SERVICENAME_CHECK_NEWS_SP=1;
SERVICENAME_CHECK_SHOP=1;
SERVICENAME_CS_CHECK_NEWS=1;
_gid=GA1.3.103723172.***;
_gat=1;
SERVICENAME_id=***%40gmail.com
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

ECSESSID is the desired session ID.

@KojiNakamaru
Copy link
Member

Thank you for logs. Starting from them, I checked various articles about WKWebView and session cookies, and implemented an experimental code in #574. You can get modified WebViewObject.cs and WebView.mm from the branch. In order to actually save/restore a session cookie, please refer changes of SampleWebView.cs.

@MakiK777
Copy link
Author

Thank you for your support.
I changed it to this script and it worked properly.

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

2 participants