Ionic Capacitor WebView: Cookies from root domain not accepted #3668
Unanswered
sibaprasadsahoo
asked this question in
Q&A
Replies: 1 comment
-
Please check my elaborate answer here: #1373 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are building an app using ionic capacitor. The app should use cookie for user to login. We are opening the signin page in capacitor webview, but after succesfull signin, its not able to set cookies in the capacitor webview, capacitor webview showing Please enable cookies.
How to enable cookies in Capacitor webview?
I'm trying to build an app with Ionic Capacitor. The app should use cookie for user to login. Let's say the server is example.com and the app in Capacitor WebView is hosted under localhost or myapp.example.com (by changing 'server --> hostname' in capacitor.config.json). The problem is, when I fired a xhr-request from the app to the server, the Set-Cookie header in the response is not accepted. Here is an example of request and response: Request: Host: example.com
Origin: https://myapp.example.com
Referer: https://myapp.example.com/
Content-Type: application/json
Response: Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS, HEAD
Access-Control-Allow-Origin: *
Set-Cookie: a=something; Domain=example.com; Path=/; HttpOnly; Secure
X-Frame-Options: sameorigin
How can I get the cookie accepted in WebView? What headers should actually be set (Access-Control-Allow-*, Set-Cookie, etc.)? Is there any other special settings in the xhr-request what I am missing?
Same question being asked:
https://stackoverflow.com/questions/64028045/ionic-capacitor-webview-cookies-from-root-domain-not-accepted
http://jtdz-solenoids.com/stackoverflow_/questions/64028045/ionic-capacitor-webview-cookies-from-root-domain-not-accepted
Beta Was this translation helpful? Give feedback.
All reactions