Auth0 Home Blog Docs

@auth0/cordova 0.3.0 w/Ionic 3 ios WKWebview doesn't close login dialog

cordova
ionic
ionic2

#1

I’ve updated my ionic app to the new @auth0/cordova library and I’m able to successfully login but the hosted login dialog is not taken down. If I manually click the Safari view Done button I get the callback with the auth information.

The Auth0/Cordova Ionic example app hasn’t been updated with any required changes so I’m not sure what I might need to do to get it to work.

I should mention everything is working fine on Android and in the iOS emulator.

I set up logging to Rollbar so I could get the actual data when the authorize call is made. This is what auth0Config becomes after calling:

        this.auth0 = new Auth0.WebAuth(auth0Config);
        this.client = new Auth0Cordova(auth0Config);


{
    "clientID": "MY_CLIENT_ID",
    "clientId": "MY_CLIENT_ID",
    "domain": "agilitycoursemaster.auth0.com",
    "callbackURL": "http://localhost:8080/var/containers/Bundle/Application/F789BB11-A1EF-44B1-9018-B5A0FF537FFA/ACMaster.app/www/index.html",
    "packageIdentifier": "com.agilitycoursemaster.acm",
    "plugins": {
        "plugins": ]
    },
    "_sendTelemetry": true,
    "_timesToRetryFailedRequests": 0,
    "tenant": "agilitycoursemaster",
    "token_issuer": "MY_AUTH0_DOMAIN/",
    "rootUrl": "MY_AUTH0_DOMAIN",
    "scope": "openid profile name given_name family_name nickname email offline_access",
    "initialScreen": "login",
    "audience": "MY_AUTH0_DOMAIN/userinfo"
}

Then I make the call to show the login:

        // Show the Auth0 widget
        const options = {
            // https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
            scope: 'openid profile name given_name family_name nickname email offline_access',
            initialScreen: this.signedUp ? 'login' : 'signUp',
            // https://community.auth0.com/questions/4437/oathtoken-refresh-token-response-with-id-token
            audience: `https://${auth0Config.domain}/userinfo`
        };
        this.rollbar.info('auth0Config ' + JSON.stringify(auth0Config));
        this.rollbar.warn('authorize ' + JSON.stringify(options));
        this.client.authorize(options, this._authorizeCB.bind(this));

The API call is successful - according to Auth0 logs but my callback is never called (unless I manually click the Done button on the browser window).

In the Auth0 Client “Allowed Callback URLs” configuration I have: http://localhost:8080

@abhishek.hingnikar do you have any suggestions?


#2

I’m wondering if the callbackURL is being generated correctly? Is that what it should look like?


#3

If anyone else comes across this - the problem I had was the ionic-plugin-deeplinks was calling it’s error callback and it wasn’t calling through to the Auth0 callback after the first time. Replacing deeplinks with cordova-plugin-customurlscheme resolved the problem and I was able to use the official version of cordova-plugin-ionic-webview.