When I click the safari icon in the login page
and open the login page in safari browser in iPhone and try to log in,
the login is redirected to the app
but the app, it’s in the same state (does not log in)
I have added the below code in Appdelegate.swift
too
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
return Auth0.resumeAuth(url, options: options)
}
Also, if I go to the browser again to see what happened, the spinner keeps on loading (the page hasn’t closed)
Could someone please help me with this.
I never did any tests with the described flow so I confess I don’t have any immediate insights about what could possibly be happening. If the application is receiving the authentication response and you can confirm that from logging then it may be that this is just an issue with the initial navigation not being closed, but this is just a guess. It may be useful for you to share the code for starting the request as well.
1 Like
@jmangelo:
func showLogin(callback: @escaping (AuthenticationResult) -> Void) {
var auth0 = Auth0
.webAuth(clientId: "xxx", domain: "xxx")
.scope("openid profile email offline_access acs_cpn")
.audience(AuthAPI.scheme + Scheme.followedBy + ConfigKey.signInAPI.keyValue + AuthAPI.userInfo)
if #available(iOS 11, *) {
auth0 = auth0.useLegacyAuthentication()
}
auth0.start { result in
switch result {
case .success(let credentials):
let appCredentials = SunCredentials(credentials: credentials)
let factory = CredentialsViewStateFactory(credentials: appCredentials)
factory.saveUserDetails()
let viewState = factory.makeViewState()
callback(AuthenticationResult.success(result: viewState))
case .failure(let error):
callback(AuthenticationResult.failure(error: error))
}
}
}
I am just using the legacy authentication in iOS 11, rest all as per the documentation.
Also, it works on the simulator not on the real device.
Thanks for sharing the code snippet; given this is constrained to a physical device my troubleshooting capabilities are somewhat limited as I don’t have any iOS device available.
If you haven’t done so already given you have a situation where the same logic has one behavior in the simulator and another on a device what I could recommend would be to go overboard in terms of code instrumentation and try to have the most detailed logging possible in all the logic that is relevant to the authentication flow.
The above is a long shot, but may give some further insights to what’s causing the discrepancy, in particular, if the logging output also varies between the flow in the simulator and device then we may gain some idea at what step the logic diverges.
Have you also tried using breakpoints so that you can also see what happens behind the scenes of the code in the Xcode console (at the moment when the spinner goes on and on)?
Sorry @konrad.sopala and @jmangelo it’s not working in simulator also now.
Also please help me to hide this safari icon in the screen to fix this issue at-least for time being.
If the issue surfaces also in the simulator then I may be able to take a further look; I don’t have any iOS test application setup to test this right now, but I’ll setup one and see what I can find. However, I’m offline tomorrow and a bit backlogged today so I may only have news next week.
1 Like
@MuraliKathir can you share the client identifier being used for the iOS application with which you’re doing the tests? (although the client identifier is not considered confidential information, feel free to share only half of the actual value)
I want to review the client configuration of the relevant application as I was unable to reproduce the issue with some client application configurations and as such want to ensure a similar configuration.
Thanks for sharing the client identifier over DM; I believe this is caused by the fact that the client application has the OIDC conformant toggle disabled. In other words, if that toggle was enabled the flow done in Safari would simply fail with an error because the act of opening with Safari with be equivalent to trying to start an authentication transaction in Chrome, copying the URL to Firefox and enter the credentials there.
What was the motivation behind having this client application disable the OIDC conformant toggle?
I have asked my backend team to have a look on OIDC. thanks @jmangelo
In the mean time, could you please help me how to hide this safari icon
?
I’m afraid that does not appear to be configurable in SFSafariViewController
(SFSafariViewController | Apple Developer Documentation) as it’s standard part of the UI for that class and I could not find any available configuration toggle.
From the docs:
UI features include the following:
- …
- A Done button, back and forward navigation buttons, and a button to open the page directly in Safari
1 Like