I would like to present arcgis.com's Sign in screen to authenticate users. So they can use SAML logins. I'm using arcgis toolkit (swift) and Authenticator/AuthenticationManager but I always get the username and password dialog. We were able to do this with UIKit but I'm not seeing how to do it using SwiftUI. Help please....
Solved! Go to Solution.
Hi @DuanePfeiffer ,
Thank you for the code. Please, mask the license key you posted in the code.
Sorry, I misunderstood your initial question. I thought you are getting prompted between application sessions even after providing credentials first time. However, look like you are prompted to enter the username/password instead of an OAuth login page. Is that correct?
If yes, is it because the `OAuthUserConfiguration` expect a portal URL and you are passing the feature service URL?
portalURL: K.vegetationManagementFeatureServiceURL
Regards,
Nimesh
Hi @DuanePfeiffer ,
Are you setting up the persistent credential stores as shown in authentication example of the toolkit?
Regards,
Nimesh
Yes, here is the code I'm using.
let config = OAuthUserConfiguration(portalURL: K.vegetationManagementFeatureServiceURL,
clientID: K.clientID,
redirectURL: K.redirectURL)
authenticator = Authenticator(oAuthUserConfigurations: [config])
// Sets authenticator as ArcGIS and Network challenge handlers to handle authentication
// challenges.
ArcGISEnvironment.authenticationManager.handleChallenges(using: authenticator)
Task {
try? await ArcGISEnvironment.authenticationManager.setupPersistentCredentialStorage(
access: .whenUnlockedThisDeviceOnly,
synchronizesWithiCloud: false
)
}
Hi @DuanePfeiffer ,
Thank you for the code. Please, mask the license key you posted in the code.
Sorry, I misunderstood your initial question. I thought you are getting prompted between application sessions even after providing credentials first time. However, look like you are prompted to enter the username/password instead of an OAuth login page. Is that correct?
If yes, is it because the `OAuthUserConfiguration` expect a portal URL and you are passing the feature service URL?
portalURL: K.vegetationManagementFeatureServiceURL
Regards,
Nimesh
You are correct. I am now using "https://www.arcgis.com" and it is working. Thanks!