-
Notifications
You must be signed in to change notification settings - Fork 3
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
Can't get plugin to work #1
Comments
Hi! Same problem for me here :( |
@kbrin423 I got mine to work. Below is the working code: In my config.xml I added the inject cookie:
In my package.json I have added it to my cordova plugins object:
In my app.component.ts I declare wkWebView:
and then when the app is initializing I check if the platform is IOS. If it is then I will manually inject a cookie:
This was a little tricky for me and there were any detailed instructions on how to set it up. Give this a try and let me know if you are still having issues. |
I got mine to work too! thx 👍 |
@juliannehalversen What wkWebview plugin did you used? |
@AlekseyPim As you can see in my config I used cordova-plugin-ionic-webview and for the cookie issue I used the one from this repo |
@juliannehalversen I have an issue with my Ionic app that affects setting session cookies. When I do login in my app, my server API sends me an Header with "Set-Cookie" param. On Android, everything works fine...but...on iOs, I can't manage to save that cookie received from the Header Response. Could you please tell me if this method will work for me? Thanks in advance. |
@juliannehalversen you have to send cookies to different header param because that one is restricted to use |
@lucky3491 Like i said, on Android everything works fine, but on iOs, my cookie isn't set. Thanks. |
@hiperiumlw Foe me the same problem with 'Set-Cookie', this plugin not help with that, it should fix another issue... |
@hiperiumlw when you received cookies from your server. You have to send that cookies array to this plugin but from server normally you get cookies in set-cookies param that is restricted to use so you have to change your response header name for cookies |
@lucky3491 So, what you suggest is to receive another Cookie Response Header like "Cookie New Name" with the value and send it to the plugin? After that, all following requests will sent the Cookie Header Request Param? |
@hiperiumlw Yes i am using this way and its working for me |
Thank you guys for your help. Make sure when calling setCookie directly you add the '/', otherwise it won't work properly.
setCookie expects (url, name, value, successCallback, errorCallback) as parameters. |
But...Are you using the wkWebView.injectCookie('YOUR API ENDPOINT HERE'); ? Why do you use wkWebView.setCookie instead of injectCookie? |
@hiperiumlw No, I am not using the injectCookie. I was having some issues with injectCookie.
Why not use setCookie? |
But....you are using this plugin, right? |
Yes, as I said in my first comment. |
Is it working with the simulator or only with real devices...? Only asking :) |
I haven't tested with the simulator yet, only using the device. |
And which versions of iOs have you tried? Thanks! |
iOS software version: 13.5.1 |
@juliannehalversen thanks a lot for your clarification about how to use this plugin with ionic. |
Is it working with iOS 14.0? mine is not working, how to debug it? |
Have just tried with iOS 14 and it doesn't work... |
Yes, thanks for clarifying. I had run into that issue as well which caused me tons of confusion |
Its not working for me even on iOS 12.4.6, iPhone 5s :( |
@hiperiumlw it is working for me in ios 14 not event change anything in this |
Hi there, |
Yeah I tried above (I had to run the add command to get the plugin installed). My bad, I can't even get the plugin installed. Failed to install 'cordova-plugin-wkwebview-inject-cookie': Error: Unable to load Platform API from /Users/w437982/work/WebKit/gf-efs-mobile-mobileapps/pay-control/platforms/ios/cordova/Api.js: |
Any fix? |
Hi! Now i installed this plugin :https://github.com/oracle/cordova-plugin-wkwebview-file-xhr 💯 |
Thanks. How do you use this to do cookies? |
How did you get this working for ios 14. |
@newuser44 Do you find how to use this plugin to get cookies? |
All the plugs I tried, including this one, I could never get working. Seems like a good number of them are not supported or have not been updated with the ios 14 updates. What I did to get this working was. Storing cookies locally -- had to write some new code to use local storage instead of cookies. So far its working but I hear ios can pretty much clear memory whenever it wants to. For login cookies in the config.xml I added a hostname tag under the ios section. This solved the problem of CORS and cookies being stored because the ios app thinks it making the call from the same server. ios app is dev.test.com and I'm making my api calls to dev.test.com.Does have to be exact. test.com won't work. (Unless that is the site). I already had a webpack.config.js script to rewrite some values in config.xml depending on which environment I was building for. I hooked into that and other environment values to rewrite this Hostname line depending on the build. So far things have worked great. |
This plugin does exactly what I need but I can't get it to work.
I added the plugin:
ionic cordova plugin add cordova-plugin-wkwebview-inject-cookie
Here is my package.json:
Here is the plugin in my config.xml:
<plugin name="cordova-plugin-wkwebview-inject-cookie" spec="https://github.com/lucky3491/cordova-plugin-wkwebview-inject-cookie" />
And here is my app.component.ts where I try to inject a dummy cookie:
I have been working on this and am not sure where I'm going wrong. Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: