hello.js icon indicating copy to clipboard operation
hello.js copied to clipboard

redirect_uri not closing in IOS simulator

Open sourabhdebnath opened this issue 5 years ago • 0 comments

Hello MrSwitch,

I tried your phonegap-demo app, replacing your code with mine like this:

hello.init({
                msft: {
                    id: CONFIG.clientId,
                    oauth: {
                        version: 2,
                        auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
                        grant: 'https://login.microsoftonline.com/common/oauth2/v2.0/token'
                    },
                    scope_delim: ' ',
                    form: false
                }
            }, {
                //
                // Define the OAuth2 return URL
                // This can be anything you like, as long as its the callback associated with the your provider-app client id.
                // It could even be localhost, e.g. http://localhost/somepath as phonegap is not run from a domain so SameOrigin breaks, instead we take advantage of being able to read the popups URL in PhoneGap
                redirect_uri : 'https://adodson.com/hello.js/redirect.html',
                oauth_proxy: 'https://auth-server.herokuapp.com/proxy'
            });

            function login(network) {
                var hi = hello(network);

                hi.login({ scope: 'Contacts.Read User.Read Files.Readwrite profile openid Directory.ReadWrite.All offline_access', response_type: 'code', force: true })
                .then(function(r) {
                    alert('CLOSED!');
                })
                .then(log, log);
            }

            function log(r){
                var s = document.createTextNode(JSON.stringify(r, null, "\t"));
                var pre = document.getElementsByTagName('pre')[0];
                pre.insertBefore(s, pre.firstChild);
            }

This works just fine, closes the redirect window and comes back to the app.

However, I create a new ionic cordova project and added the same code in my app.component.ts, everything works fine till the redirect_uri but the redirect_uri does not close in IOS Simulator. I have added cordova whitelist plugin and inappbrowser to my app. Just wondering whats going wrong. It would be great if you can point me to the right direction.

Ionic Version: 4.12.0 Cordova: 9.0.0 HelloJS Version: 1.18.0 Simulator: iPhone-X, 12.1 simulator

sourabhdebnath avatar Mar 31 '19 07:03 sourabhdebnath