jeudi 3 janvier 2019

How can I use cordova's InAppBrowser in an Ember application?

We're creating a hybrid app using the Corber addon for Ember and we wish to use the InAppBrowser plugin for Cordova to enable user authentication.

How can we access the cordova.InAppBrowser object within Ember?

I've added the below code to the authenticator's authenticate method as recommended by various sites, however cordova is showing as undefined. I haven't been able to find any documentation as to what to import into the file to enable the cordova.InAppBrowser object.

const browser = cordova.InAppBrowser.open(<someUrl>, "_blank", {
    location: "no", 
    toolbar: "no", 
    hidenavigationbuttons: "yes"
});
browser.addEventListener('loadstart', function(event) {
    if (event.url.indexOf(<someRedirectUrl>) === 0) {
        browser.close();
    }
});

I would like to be able to open "someUrl" in an InAppBrowser to allow users to authenticate using an OAuth2 site.

Many thanks




Aucun commentaire:

Enregistrer un commentaire