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

SFSafariController is not returning back to app after Authenticating with Azure AD #136

Open
KitGardner opened this issue Oct 1, 2020 · 3 comments

Comments

@KitGardner
Copy link

Hi there. I am developing a customer Portal App for IOS and Android. At the moment we are focusing on IOS. We use Active Directory as our Identity provider so I am using the microsoft provider to interface with it. As they are OpenID compliant this causes the plugin to go the route of using the SFSafariController instead of a web view. There are two issues I have been running into.

The first one is that the first time I kick off the login it fails, I get a message about the SFSafariController was not found during runtime and it is now being initialized. I suspect this is something that I just need to wrap an error handler around or try to initialize early in the app life.

The second issue is that when the SFSafariController is loaded, I am able to sign in successfully, but then the controller just sits there loading eternally and I am not getting my access token from the call.

I tried commenting out the code that decides to use the SafariController if the provider is OpenId-Full so that it has to use a web view and this is working. The user can sign in and we get a token.

I would prefer to use the SFSafariController since it is more secure but as mentioned already it gets stuck. I know that my app is
setup correctly for the redirect because I can enter the custom URL in my devices' browser and it opens my app. Additionally, I played with another plugin to override the UIApplicationDelegate and with this I was able to grab the Authorization Code from the Safari Controller. I can use this and do the rest of the auth flow myself, but I currently don't have a solution to close the browser. So that is not a big sticking point, but I would prefer a smoother experience.

My final thoughts is that I suspect the issue lies somewhere in the ios application delegate that is created when it goes down the path of using the SFSafariController.

One final thing I want to add, is that we have users from two different Active Directories, so I cannot initialize the provider when the app opens. I first need the user to enter an email for the first time, and then the app remembers what domain they are in from then on.

Due to this, I do have to change the authority and tokenEndpointBase properties of the microsoft provider to use our custom
tenant Id instead of common.

Which platform(s) does your issue occur on?

So far it is just IOS. I have not tested on Android

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

  • CLI: 6.5.0
  • Cross-platform modules: 6.5.18
  • Runtime(s):
    IOS : 6.5.2
    Android: 6.5.3
  • Plugin(s):

"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@nativescript/theme": "~2.3.3",
"karma": "*",
"karma-jasmine": "3.1.1",
"karma-nativescript-launcher": "0.4.0",
"karma-webpack": "3.0.5",
"nativescript-angular": "~8.21.0",
"nativescript-oauth2": "^2.4.4",
"nativescript-plugin-firebase": "^10.5.2",
"nativescript-ui-calendar": "^6.1.0",
"nativescript-unit-test-runner": "^0.7.0",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.4.0",
"tns-core-modules": "~6.5.0",
"tns-platform-declarations": "^6.5.15",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular/compiler-cli": "~8.2.0",
"@ngtools/webpack": "~8.2.0",
"@types/jasmine": "^3.5.9",
"nativescript-dev-webpack": "~1.5.1",
"typescript": "~3.5.3"
}

@email-nkishor
Copy link

Hi @NathanWalker @alexziskind1

I am facing same issue on IOS and android build working fine. still working on it and waiting for solutions.

@keithgulbro
Copy link

keithgulbro commented Nov 11, 2020

Ran into the same issue. In my case, updating my project to Nativescript 7 and removing any rogue files that weren't needed did the trick.

@Thisgio
Copy link

Thisgio commented Jul 13, 2021

@KitGardner Still no fix?

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

4 participants