Performing Manual Authorization Requests
Perform manual authorization requests by configuring an AuthorizationService
. Pass the code and associated identifiers to your secure server to complete the token request flow.
import ZenKeySDK
class LoginViewController {
let authService = AuthorizationService()
func loginWithZenKey() {
// In response to some UI, perform an authorization using the AuthorizationService.
let scopes: [Scope] = [.openid, .email, .name, .phone, .postalCode]
authService.authorize(
scopes: scopes,
fromViewController: self) { result in
switch result {
case .code(let authorizedResponse):
let code = authorizedResponse.code
let mccmnc = authorizedResponse.mccmnc
let redirectURI = authorizedResponse.redirectURI
let nonce = authorizedResponse.nonce
let correlationId = authorizedResponse.correlationId // string
let context = authorizedResponse.context // string
// Pass these identifiers to your secure server to perform a token request
case .error:
// Error is returned identity provider
case .cancelled:
// The user cancelled request in ZenKey application.
}
}
}
}
Updated about 1 year ago
Did this page help you?