GithubHelp home page GithubHelp logo

cwbudde / cordova-plugin-wkwebview-inject-cookie Goto Github PK

View Code? Open in Web Editor NEW
45.0 5.0 24.0 41 KB

Injects a cookie in order to start the sync processs with wkWebView

License: Apache License 2.0

Objective-C 73.95% JavaScript 26.05%
inject cookie wkwebview first

cordova-plugin-wkwebview-inject-cookie's People

Contributors

cwbudde avatar mkmacedon avatar qkdreyer avatar toddtarsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cordova-plugin-wkwebview-inject-cookie's Issues

Plugin seems to not work on ios 14

Hello, I'm using this amazing plugin for sync cookies between main app and iframes inside the app.
With 2 code lines I make everything work.... since now.

With ios 14 the plugin seems to have no effect any more but still working on ios 13 and ios 12 (tested on ios emulator and the new version of xcode).
Is there any way to make this little gem works on ios 14 too?
I expect that customers can be a little disappointed after they update ios the the new version...
Thanks,
Marco

Cookie needs to set an expiration for compatibility with InAppBrowser

Re: apache/cordova-plugin-inappbrowser#509 (comment)

The linked issue from InAppBrowser explains: "In iOS cookies are not persistent once app is exited and restarted. This creates problem with hosted web app saving cookies or local storage."

And the linked issue comment itself is from a user who attempted to use cordova-plugin-wkwebview-cookie-sync but to no effect. I'm also using this plugin which has been working well, except that when exiting the app to the system browser, through InAppBrowser, the user is immediately logged out of the app, loses session/cookies, and returns to find the app landing/login screen, rather than where they originally exited from.

If cordova-plugin-wkwebview-cookie-sync could set an expiration, arbitrarily far into the future (e.g. "12/31/9999") it should solve this problem (re: apache/cordova-plugin-inappbrowser#509 (comment)).

"... By setting an explicit expiration date on the cookie returned by the server this causes the browser to treat it as persistent."

Could you advise on how to set the expiration? (Either hardcoded in the plugin, or as an argument when calling "injectCookie").

ionic4

I am using the latest Ionic4, with angular7, there I am using normal httpClient with Obervables as responses. I added your plugin and setup the inject cookie, but still getting seeing that the backend is not receiving the keys, any idea where to look?

Cookies are not synched with WKWebView

Hello,
i'm trying to make cookies work on my iOS cordova app using your cookie injection plugin combined with Oracle's WKWebView plugin (https://github.com/oracle/cordova-plugin-wkwebview-file-xhr). I've called the cookie plugin setup as it's on the documentation:

document.addEventListener('deviceready', () => { wkWebView.injectCookie('mydomain.com/mypath'); });

And then using CookieMaster plugin (https://github.com/RTK/cordova-cookie-emperor), i'm trying to set the cookies but they're not set at all.

Can you please describe if the plugin has to be combined with some specific WKWebView cordova plugin other than Oracle's (i've already tried all available WKWebView plugins) or if it's something wrong with the plugin call? Thank you in advance.

Not working for iPhone-X silmulator

I installed the plugin, and modified the file ".//platforms/ios/App.xcarchive/Products/Applications/ App.app/www/js/index.js" by adding the line:

var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},

// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function() {
    this.receivedEvent('deviceready');
},

// Update DOM on a Received Event
receivedEvent: function(id) {
    var parentElement = document.getElementById(id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');

    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');
    // *** add the cookie handling line (IP is the computer running the backend server): ***//
    wkwebview.injectCookie('http://10.204.155.132:8888/');
    console.log('Received Event: ' + id);
}

};

app.initialize();

The question is do I put the line into the correct file or the IP is not the way to be used for myDomain?

Not setting cookies on latest version of ionic

This plugin was very useful, however it has recently stopped working after updating ionic and ios dependencies on the ios emulator.

When debugging using safari:

  • no cookies are visible in the storage tab after calling injectCookie
  • After injectCookie, and making a session call: although the set-cookie header is returned in the response, no cookies are stored
  • All future calls that require cookie are blocked (as needed for session authentication)

Environment
Ionic:

Ionic CLI : 5.4.13 (/Users/zeer/Documents/KitchenMate/kitchenmate/node_modules/ionic)
Ionic Framework : unknown
@ionic/v1-toolkit : 2.0.18

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : ios 5.1.1
Cordova Plugins : cordova-plugin-ionic 5.4.6, cordova-plugin-ionic-webview 4.1.3, (and 7 other plugins)

Utility:

cordova-res : 0.8.1
native-run : 0.3.0

System:

Android SDK Tools : 26.1.1 (/Users/zeer/Library/Android/sdk)
ios-deploy : 1.10.0
ios-sim : 8.0.2
NodeJS : v10.15.3 (/Users/zeer/.nvm/versions/node/v10.15.3/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 11.3 Build version 11C29

Plugins
cordova-plugin-android-permissions 1.0.2 "Permissions"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-ionic 5.4.6 "cordova-plugin-ionic"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-wkwebview-inject-cookie 1.0.2 "WKWebViewInjectCookie"
ionic-plugin-deeplinks 1.0.20 "Ionic Deeplink Plugin"
onesignal-cordova-plugin 2.8.1 "OneSignal Push Notifications"

Not Supported

Using cordova-fetch for cordova-plugin-wkwebview-inject-cookie@^1.0.2

Adding cordova-plugin-wkwebview-inject-cookie project...
Unable to load PlatformApi from platform. Error: Cannot find module

'D:\Projects\Final\2\node_modules\cordova-plugin-wkwebview-inject-cookie'
Unhandled error. (The platform "cordova-plugin-wkwebview-inject-cookie" does not appear to be a valid cordova platform. It is missing API.js. cordova-plugin-wkwebview-inject-cookie not supported.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.