Skip to content
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

After SSO login using InAppBrowser plugin, it doesnot persist cookies while returning to app so unable to reload ios app #1110

Open
3 tasks done
priyankabakkar opened this issue May 19, 2021 · 3 comments

Comments

@priyankabakkar
Copy link

priyankabakkar commented May 19, 2021

Bug Report

Problem

We have hybrid app developed using cordova. Our app is “SwiftEnterprise” available on apple store.
We have functionality of SSO login which we are achieving using InAppBrowser plugin. Earlier it was working fine but from Aug 2020 it stopped working for ios.

We are able to login to SSO url, using InAppBrowser plugin but after login we were redirecting to our main app. Issue is, now we are not able to reload our app as jsession cookies are missing. Application not able to load. I guess it is cookies issue, I tried setting manual cookies as well but nothing works out.

What is expected to happen?

After successful SSO login we redirect back to main application by closing inappbrowser. Here we expect to get jsession Id so that our session timeout will not happen and app can able to reload

What does actually happen?

Currently on login we are getting session timeout because of missing cookies

Information

Using InAppBrowser plugin's target "_blank" to load sso url and then after successful login we redirect it to our own app

Command or Code

/* This api for SSO/Netscalar login */
MobileApp.Directlogin = function(a_event) {
	var w_appData = JSON.parse(localStorage.getItem('appData') ? localStorage.getItem('appData') : '{}');
	var w_url= w_appData.appUrl;
    var w_target = '_blank';
    var w_options = 'location=yes,clearsessioncache=no,clearcache=no,closebuttoncaption=Close,closebuttoncolor=red,hideurlbar=yes';
    var w_authPage = cordova.InAppBrowser.open(w_url, w_target, w_options);

    w_authPage.addEventListener("loadstop", function () {
        w_authPage.executeScript (
            { code: "document.body.innerText" },
            function( values ) {

                if (values[0].indexOf("cobrandPath") > -1) {
                    var w_loginResponse = JSON.parse(values[0]);

                    if (w_loginResponse.loginStatus) {
                        w_authPage.close();
                        var w_LandingURL = 'maxema/index_mobile.html?';

                        for (var w_dataVal in w_loginResponse) {
                            if (w_dataVal != 'loginStatus') {
                                w_LandingURL += w_dataVal + '=' + w_loginResponse[w_dataVal] + '&';
                            }
                        }
                        w_LandingURL = w_LandingURL.substr(0, w_LandingURL.length - 1);
                        window.location = w_LandingURL;
                    }
                }
            }
        );

   });
  w_authPage.addEventListener("exit", function () {
     MobileApp.changeServer();
 })
};

Environment, Platform, Device

Our app is hybrid app and we are facing this issue on IOS platform since aug 2020

Version information

cordova version -10.0.0
cordova Installed platforms:
android 7.0.0
ios 6.2.0
InAppBrowser - cordova-plugin-inappbrowser 5.0.0
Xcode - Version 12.4 (12D4e)

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@timbru31
Copy link
Member

Thanks a lot for your issue, however the issue template exists for a reason. 😊
It helps us to debug the issue further and to provide a solution much faster. With important information missing, we unfortunately can't help you.

Therefore, please edit this issue accordingly or close and create a new one and make sure to provide all the required information.

@priyankabakkar
Copy link
Author

Yes I have added remaining details as well.. please go throught them

@oVerde
Copy link

oVerde commented Feb 18, 2022

Having the same issue, has anything being done in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants