AdyenAuthentication SDK Provides reusable and easy to use two factor authentication for security sensitive use cases like banking, issuing and PSD2 strong customer authentication.
The SDK is available via CocoaPods, Carthage, Swift Package Manager or via manual installation.
- Add
pod 'AdyenAuthentication'
to yourPodfile
. - Run
pod install
.
- Add
github "adyen/adyen-authentication-ios"
to yourCartfile
. - Run
carthage update
. - Link the framework with your target as described in Carthage Readme.
Drag the dynamic XCFramework/Dynamic/AdyenAuthentication.xcframework
to the Frameworks, Libraries, and Embedded Content
section in your general target settings. Select "Copy items if needed" when asked.
- Drag the static
XCFramework/Static/AdyenAuthentication.xcframework
to theFrameworks, Libraries, and Embedded Content
section in your general target settings. - Make sure the static
AdyenAuthentication.xcframework
is not embedded.
- Follow Apple's Adding Package Dependencies to Your App guide on how to add a Swift Package dependency.
- Use
https://github.com/Adyen/adyen-authentication-ios
as the repository URL. - Specify the version to be at least
1.0.0
.
There are two configuration options.
- Using device check apis
let configuration = AuthenticationService.Configuration(localizedRegistrationReason: // Text explaining to the user why we need their biometrics while registration,
localizedAuthenticationReason: // Text explaining to the user why we need their biometrics while authentication.
appleTeamIdentifier: // The Apple registered development team identifier.)
self.authenticationService = AuthenticationService(configuration: configuration)
- Using Apple passkeys
let configuration = AuthenticationService.PassKeyConfiguration(
relyingPartyIdentifier: "com.example.com",
displayName: "App name"
)
self.authenticationService = AuthenticationService(configuration: configuration)
let deviceSupport: String = try authenticationService.checkSupport()
This call will throw an error in case the current device is not supported, otherwise returns an opaque string payload that needs to be sent to backend API depending on the use case.
authenticationService.isDeviceRegistered(withAuthenticationInput: input /*The opaque string sdk input*/) { [weak self] result in
switch result {
case let .success(isRegistered):
/// output is a Boolean indicating whether the current device is registered,
/// then you can call `authenticate` function below.
case let .failure(error):
/// Error raised,
/// for example if the device is not protected by either pass code, face Id, or fingerprint, or if device is not registered,
/// then you can call `register` function below.
}
}
// OR you can also use the async version of this function:
let isDeviceRegistered = try await authenticationService.isDeviceRegistered(withAuthenticationInput: input /*The opaque string sdk input*/)
authenticationService.register(withRegistrationInput: input /*The opaque string sdk input*/) { [weak self] result in
switch result {
case let .success(output):
/// output is an opaque string that should be sent to Adyen backend API (depending on the use case) to be validated for registration to be finalized.
case let .failure(error):
/// Failure to register the device, for example if the device is not protected by either pass code, face Id, or fingerprint.
}
}
// OR you can also use the async version of this function:
let sdkOutput = try await authenticationService.register(withRegistrationInput: input /*The opaque string sdk input*/)
authenticationService.authenticate(withAuthenticationInput: input /*The opaque string sdk input*/) { result in
switch result {
case let .success(output):
/// output is an opaque string that should be sent to Adyen backend API (depending on the use case) to be validated for authentication to be finalized.
case let .failure(error):
/// Failure to authenticate, which usually means that the current account is not registered.
}
}
// OR you can also use the async version of this function:
let sdkOutput = try await authenticationService.authenticate(withAuthenticationInput: input /*The opaque string sdk input*/)
If you have a feature request, or spotted a bug or a technical problem, create an issue here.
For other questions, contact our support team.
This SDK is available under the Apache License, Version 2.0. For more information, see the LICENSE file.