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

ResumeWithUrl does not work on IOS for Nativescipt < 7. WebView does not close on Microsoft login flow #225

Open
d1820 opened this issue Dec 6, 2024 · 0 comments

Comments

@d1820
Copy link

d1820 commented Dec 6, 2024

Make sure to check the demo app(s) for sample usage

When trying to do the native controller auth flow with microsoft and MFA is enabled it gets stuck on the final microsoft screen and does not return to the application.

Which platform(s) does your issue occur on?

  • iOS

Please, provide the following version numbers that your issue occurs with:

  • CLI: 8.3.3
  • Cross-platform modules: 6.6.0-next-2020-05-08-112112-01

Issue

the authState of the subcontroller is being cleared some how. and by the time it gets to resumeWithUrl its null.

I Updated the TnsOAuthLoginSubController with the following, and added better error handling

This fixed the issue on IOS, and also fixed a logout issue for Android and IOS. Hope this maybe helps someone else

    TnsOAuthLoginSubController.prototype.resumeWithUrl = function(url, completion) {
        if (platformModule.isIOS && !this.authState) { //added this check
            this.authState = new tns_oauth_auth_state_1.TnsOAuthState(this.client.codeVerifier, false, completion);
        }
        if (this.authState) {
            if (this.authState.isLogout) {
                if (url === this.client.provider.options.redirectUri || url.indexOf(this.client.provider.options.redirectUri) > -1) { //added this check
                    this.client.logout();
                    completion(undefined);
                } else {
                    completion(undefined, {
                        message: "ERROR Occurred: Url and options.redirectUri do not match",
                        url,
                        redirectUri: this.client.provider.options.redirectUri
                    });
                }
                return true;
            }
            else {
                var codeExchangeRequestUrl = this.codeExchangeRequestUrlFromRedirectUrl(url);
                if (codeExchangeRequestUrl) {
                    this.codeExchangeWithUrlCompletion(codeExchangeRequestUrl, completion);
                    return true;
                }
            }
        }
        return false;
    };
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

1 participant