Delegated Authentication
The establishAuthentication
method facilitates the authentication of users managed by your identity provider.
This method requires two parameters. The first parameter must be a string that uniquely identifies the user, and the second parameter is a closure that receives a string as input and outputs a string.
Inside the provided closure, you must send the input string to the designated backend endpoint within your domain to initiate authentication. Upon success, the request should return a string that must be returned from the closure.
If the Vipaso SDK successfully establishes authentication for the provided user, it triggers a callback through the VipasoPayDelegate.onAuthenticationStateChange
method with the updated authentication state.
try await vipasoPay.delegatedAuth.establishAuthentication(
userIdentifier: userIDString,
connect: { input in
// Input is a String provided by the Vipaso SDK
// Send the input string to the dedicated backend endpoint in your domain
// Return the output string received from your backend
return output
}
)
Expect the outcome in the callback at:
extension VipasoAuthenticationConsumer: VipasoPOSDelegate {
...
func onAuthenticationStateChange(vipaso: VipasoPOSProtocol, authenticated: Bool) {
if authenticated {
// Handle successful authentication
} else {
// Handle authloss/unauthenticated cases for Vipaso SDK
}
}
...
}
Updated 8 days ago