Customer authentication
Set Client State delegate
This method sets an object for a customer’s state delegate methods.
Declared In:
Headers/SNRClient.h
Related To:
ClientStateDelegate
Class:
Client
Declaration:
static func setClientStateDelegate(_ delegate: ClientStateDelegate)
Discussion:
Learn more about the methods and the purpose of this listener here.
Register customer account
This method registers a new customer with an email, password, and optional data.
This method requires the context object with a customer’s email, password, and optional data. Omitted fields are not modified.
Depending on the backend configuration, the account may require activation. For details, see customer registration.
Do not allow signing in again (or signing up) when a customer is already signed in. Sign the customer out first.
Do not create multiple instances nor call this method multiple times before execution.
This method is a global operation and doesn’t require customer authentication.
SAUTH_REGISTER_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Related To:
ClientRegisterAccountContext
Class:
Client
Declaration:
static func registerAccount(context: ClientRegisterAccountContext, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
context | ClientRegisterAccountContext | yes | - | Object with the customer’s email, password, and other optional data |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let agreements: ClientAgreements = ClientAgreements()
agreements.email = true
agreements.sms = true
agreements.push = true
agreements.bluetooth = true
agreements.rfid = true
agreements.wifi = true
let email: String = "YOUR_EMAIL"
let password: String = "YOUR_PASSWORD"
let context: ClientRegisterAccountContext = ClientRegisterAccountContext(email: email, password: password)
context.firstName = "FIRST_NAME"
context.lastName = "LAST_NAME"
context.customId = "CUSTOM_ID"
context.sex = .male
context.phone = "123-456-789"
context.company = "Synerise"
context.address = "Lubostroń 1"
context.city = "Kraków"
context.province = "Małopolskie"
context.zipCode = "30-383"
context.countryCode = "+48"
context.agreements = agreements
context.attributes = ["attribute1": "value1", "attribute2": "value2"]
context.tags = ["tag1", "tag2" "tag3"]
Client.registerAccount(context: context, success: { (success) in
// success
}, failure: { (error) in
// failure
})
Confirm customer account
This method confirms a customer account with the confirmation token.
This method is a global operation and doesn’t require customer authentication.
SAUTH_CONFIRMATION_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func confirmAccount(token: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
token | String | yes | - | Confirmation token |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let token: String = "TOKEN"
Client.confirmAccount(token: token, success: { (success) in
// success
}, failure: { (error) in
// failure
})
Activate customer account
This method requests sending an email with a URL that confirms the registration and activates the account.
This method is a global operation and doesn’t require customer authentication.
SAUTH_CONFIRMATION_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func activateAccount(email: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
String | yes | - | Customer’s email | |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let email: String = "EMAIL"
Client.activateAccount(email: email, success: { (success) in
// success
}) { (error) in
// failure
}
Request customer account activation by pin
This method requests a customer’s account registration process with the PIN code.
This method is a global operation and doesn’t require customer authentication.
SAUTH_PIN_CODE_RESEND_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func requestAccountActivationByPin(email: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
String | yes | - | Customer’s email | |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let email: String = "EMAIL"
Client.requestAccountActivationByPin(email: email, success: { _ in
// success
}) { (error) in
// failure
}
Confirm customer account activation by pin
This method confirms a customer’s account registration process with the PIN code.
This method is a global operation and doesn’t require customer authentication.
SAUTH_PIN_CODE_RESEND_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func confirmAccountActivationByPin(pinCode: String, email: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
pinCode | String | yes | - | Code sent to a customer’s email |
String | yes | - | Customer’s email | |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let pinCode: String = "PIN_CODE"
let email: String = "EMAIL"
Client.confirmAccountActivationByPin(pinCode: pinCode, email: email, success: { _ in
// success
}) { (error) in
// failure
}
Sign in a customer
This method signs a customer in to obtain a JSON Web Token (JWT) which can be used in subsequent requests.
The SDK will refresh the token before each call if it is about to expire (but not expired).
Do NOT allow signing in again (or signing up) when a customer is already signed in. First, sign the customer out.
Do NOT create multiple instances nor call this method multiple times before execution.
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func signIn(email: String, password: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
String | yes | - | Customer’s email | |
password | String | yes | - | Customer’s password |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let email: String = "EMAIL"
let password: String = "PASSWORD"
Client.signIn(email: email, password: password, success: { (success) in
// success
}, failure: { (error) in
// failure
})
Sign in a customer conditionally
This method signs a customer in to obtain a JSON Web Token (JWT) which can be used in subsequent requests.
The SDK will refresh the token before each call if it is about to expire (but not expired).
Do NOT allow signing in again (or signing up) when a customer is already signed in. First, sign the customer out.
Do NOT create multiple instances nor call this method multiple times before execution.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func signInConditionally(email: String, password: String, success: ((ClientAuthenticationResult) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
String | yes | - | Customer’s email | |
password | String | yes | - | Customer’s password |
success | ((ClientAuthenticationResult) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let email: String = "EMAIL"
let password: String = "PASSWORD"
Client.signInConditionally(email: email, password: password, success: { (result) in
// success
}, failure: { (error) in
// failure
})
Authenticate customer by IdentityProvider
This method authenticates a customer with OAuth, Facebook, Google, Apple, or Synerise.
If an account for the customer does not exist and the identity provider is different than Synerise, this request creates an account.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.7.6 | 3.8.0 | 0.9.19 | 0.3.0 |
Declared In:
Headers/SNRClient.h
Related To:
ClientAuthenticationContext
ClientIdentityProivider
Class:
Client
Declaration:
static func authenticate(token: AnyObject, clientIdentityProvider: ClientIdentityProvider, authID: String?, context: ClientAuthenticationContext?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
token | AnyObject | yes | - | Token retrieved from provider |
clientIdentityProvider | ClientIdentityProvider | yes | - | Provider of your token |
authID | String | no | nil | Optional identifier of authorization |
context | ClientAuthenticationContext | no | nil | Object which contains agreements and attributes |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let agreements: ClientAgreements = ClientAgreements()
agreements.email = true
agreements.sms = true
agreements.push = true
agreements.bluetooth = true
agreements.rfid = true
agreements.wifi = true
let context: ClientAuthenticationContext = ClientAuthenticationContext()
context.agreements = agreements
context.attributes = ["attribute1": "value1", "attribute2": "value2"]
let accessToken: String = "ACCESS_TOKEN"
let authID: String = "AUTH_ID"
Client.authenticate(token: token, authID: authID, context: context, success: { (success) in
// success
}) { (error) in
// failure
}
Authenticate customer conditionally by IdentityProvider
This method authenticates a customer with OAuth, Facebook, Google, Apple, or Synerise.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Related To:
ClientConditionalAuthResult
ClientIdentityProvider
Class:
Client
Declaration:
static func authenticateConditionally(token: AnyObject, clientIdentityProvider: ClientIdentityProvider, authID: String?, context: ClientConditionalAuthenticationContext?, success: ((ClientAuthenticationResult) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
token | AnyObject | yes | - | Token retrieved from provider |
clientIdentityProvider | ClientIdentityProvider | yes | - | Provider of your token |
authID | String | no | nil | Optional identifier of authorization |
context | ClientConditionalAuthenticationContext | no | nil | Object which contains agreements and attributes |
success | ((ClientConditionalAuthResult) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let agreements: ClientAgreements = ClientAgreements()
agreements.email = true
agreements.sms = true
agreements.push = true
agreements.bluetooth = true
agreements.rfid = true
agreements.wifi = true
let context: ClientConditionalAuthenticationContext = ClientConditionalAuthenticationContext()
context.agreements = agreements
context.attributes = ["attribute1": "value1", "attribute2": "value2"]
let accessToken: String = "ACCESS_TOKEN"
let authID: String = "AUTH_ID"
Client.authenticateConditionally(token: token, authID: authID, context: context, success: { (success) in
// success
}) { (error) in
// failure
}
Authenticate customer with token payload
This method signs in a customer in with the provided token payload.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 4.15.0 | 5.15.0 | n/a | n/a |
Declared In:
Headers/SNRClient.h
Related To:
TokenPayload
Class:
Client
Declaration:
static func authenticate(tokenPayload: TokenPayload, authID: String, success: (() -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
tokenPayload | TokenPayload | yes | - | Object which contains a token’s payload |
authID | String | yes | - | Required customer’s identifier of authorization |
success | (() -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Authenticate customer via Simple Authentication
This method authenticates a customer with Simple Authentication.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 4.14.0 | 5.7.1 | 0.15.0 | 0.7.0 |
Synerise.setRequestValidationSalt(_:)
method (if salt is enabled for Simple Authentication).SAUTH_SIMPLE_AUTH_CREATE
from the Auth group.Declared In:
Headers/SNRClient.h
Related To:
ClientSimpleAuthenticationData
Class:
Client
Declaration:
static func simpleAuthentication(data: ClientSimpleAuthenticationData, authID: String, success: (() -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
data | ClientSimpleAuthenticationData | yes | - | Object which contains customer data |
authID | String | yes | - | Required identifier of authorization |
success | (() -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Check if a customer is signed in (via RaaS, OAuth, Facebook, Apple)
This method checks if a customer is signed in (via RaaS, OAuth, Facebook, Apple).
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func isSignedIn() -> Bool
Return Value:
true if the customer is signed in, otherwise returns false.
Example:
let isSignedIn: Bool = Client.isSignedIn()
Check if a customer is signed in (via Simple Authentication)
This method checks if a customer is signed in (via Simple Authentication).
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 4.14.0 | 5.7.1 | 0.15.0 | 0.7.0 |
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func isSignedInViaSimpleAuthentication() -> Bool
Return Value:
true if the customer is signed in (via Simple Authentication), otherwise returns false.
Sign out customer
This method signs out a customer out.
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func signOut() -> Void
Return Value:
No value is returned.
Example:
Client.signOut()
Sign out customer with mode or from all devices
This method signs out a customer out with a chosen mode and Determines if the method should sign out all devices.
Available modes:
.signOut
mode signs out the customer..signOutWithSessionDestroy
mode signs out the customer and additionally, clears the anonymous session and regenerates the customer UUID.
The fromAllDevices
parameter determines whether the method should notify the backend to sign out all devices.
IMPORTANT: It is an asynchronous method.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 4.11.0 | 5.1.0 | 0.14.0 | 1.0.0 |
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func signOut(mode: ClientSignOutMode, fromAllDevices: Bool, success: ((Bool) -> Void), failure: ((ApiError) -> Void))
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
mode | ClientSignOutMode | yes | - | Mode of signing out |
fromAllDevices | Bool | yes | - | Determines if the method should sign out all devices |
success | (() -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Client.signOut(mode: .signOutWithSessionDestroy, fromAllDevices: true, success: {
// success
}) { (error) in
// failure
}
Deprecated methods
Authenticate customer by OAuth with registration
This method authenticates a customer with OAuth.
If an account for the customer does not exist, this request creates an account.
Available on | iOS SDK | Android SDK | React Native SDK | Flutter SDK |
---|---|---|---|---|
Introduced in: | 3.6.11 | 3.6.13 | 0.9.12 | n/a |
Deprecated in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Related To:
ClientOAuthAuthenticationContext
Class:
Client
Declaration:
static func authenticateByOAuth(accessToken: String, authID: String?, context: ClientOAuthAuthenticationContext?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
accessToken | String | yes | - | OAuth Access Token |
authID | String | no | nil | Optional identifier of authorization |
context | ClientOAuthAuthenticationContext | no | nil | Object which contains agreements and attributes |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let agreements: ClientAgreements = ClientAgreements()
agreements.email = true
agreements.sms = true
agreements.push = true
agreements.bluetooth = true
agreements.rfid = true
agreements.wifi = true
let context: ClientOAuthContext = ClientOAuthContext()
context.agreements = agreements
context.attributes = ["attribute1": "value1", "attribute2": "value2"]
let accessToken: String = "ACCESS_TOKEN"
let authID: String = "AUTH_ID"
Client.authenticateByOAuth(accessToken: accessToken, authID: authID, context: context, success: { (success) in
// success
}) { (error) in
// failure
}
Authenticate customer by OAuth without registration
This method authenticates a customer with OAuth.
Available on | iOS SDK | Android SDK | React Native SDK | Flutter SDK |
---|---|---|---|---|
Introduced in: | 3.6.11 | 3.6.13 | 0.9.12 | n/a |
Deprecated in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func authenticateByOAuthIfRegistered(accessToken: String, authID: String?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
accessToken | String | yes | - | OAuth Access Token |
authID | String | no | nil | Optional identifier of authorization |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Authenticate customer by Facebook with registration
This method authenticates a customer with Facebook.
If an account for the customer does not exist, this request creates an account.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.3.8 | 3.3.0 | 0.9.7 | n/a |
Deprecated in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Related To:
ClientFacebookAuthenticationContext
Class:
Client
Declaration:
static func authenticateByFacebook(facebookToken: String, authID: String?, context: ClientFacebookAuthenticationContext?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
facebookToken | String | yes | - | Facebook Access Token |
authID | String | no | nil | Optional identifier of authorization |
context | ClientFacebookAuthenticationContext | no | nil | Object which contains agreements and attributes |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let agreements: ClientAgreements = ClientAgreements()
agreements.email = true
agreements.sms = true
agreements.push = true
agreements.bluetooth = true
agreements.rfid = true
agreements.wifi = true
let context: ClientFacebookAuthenticationContext = ClientFacebookAuthenticationContext()
context.agreements = agreements
context.attributes = ["attribute1": "value1", "attribute2": "value2"]
guard let facebookToken = FBSDKAccessToken.current()?.tokenString else {
return
}
let authID: String = "AUTH_ID"
Client.authenticateByFacebook(facebookToken: fa, authID: authID, context: context, success: { (success) in
// success
}) { (error) in
// failure
}
Authenticate customer by Facebook without registration
This method authenticates a customer with Facebook.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.3.8 | 3.3.0 | 0.9.7 | n/a |
Deprecated in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func authenticateByFacebookIfRegistered(facebookToken: String, authID: String?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
facebookToken | String | yes | - | Facebook Access Token |
authID | String | no | nil | Optional identifier of authorization |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
guard let facebookToken = FBSDKAccessToken.current()?.tokenString else {
return
}
let authID: String = "AUTH_ID"
Client.authenticateByFacebookIfRegistered(facebookToken: facebookToken, success: { (success) in
// success
}, failure: { (error) in
// failure
})
Authenticate customer by Sign in with Apple with registration
This method authenticates a customer with Sign In With Apple.
If an account for the customer does not exist, this request creates an account.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.6.11 | 3.6.13 | 0.9.12 | n/a |
Deprecated in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Related To:
ClientAppleSignInAuthenticationContext
Class:
Client
Declaration:
static func authenticateByAppleSignIn(identityToken: Data, authID: String?, context: ClientAppleSignInAuthenticationContext?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
identityToken | Data | yes | - | Apple Identity Token |
context | ClientAppleSignInAuthenticationContext | no | nil | Object which contains agreements and attributes |
authID | String | no | nil | Optional identifier of authorization |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
extension LoginViewController: ASAuthorizationControllerDelegate {
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
let agreements: ClientAgreements = ClientAgreements()
agreements.email = true
agreements.sms = true
agreements.push = true
agreements.bluetooth = true
agreements.rfid = true
agreements.wifi = true
let context: ClientAppleSignInAuthenticationContext = ClientAppleSignInAuthenticationContext(identityToken: appleIdCredential.identityToken!)
context.agreements = agreements
context.attributes = ["param": "value"]
Client.authenticateByAppleSignIn(context: context, authID: authID, success: { (success) in
// success
}) { (error) in
// failure
}
}
}
}
Authenticate customer by Sign in with Apple without registration
This method authenticates a customer with Sign In With Apple.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.6.11 | 3.6.13 | 0.9.12 | n/a |
Deprecated in: | 3.7.6 | 3.8.0 | 0.9.19 | n/a |
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func authenticateByAppleSignInIfRegistered(identityToken: String, authID: String?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
identityToken | String | yes | - | Apple Identity Token |
authID | String | no | nil | Optional identifier of authorization |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Sign out customer with mode
This method signs out a customer out with a chosen mode:
.signOut
mode notifies the backend that the customer is signed out..signOutWithSessionDestroy
mode notifies the backend that the customer is signed out and additionally, clears the anonymous session and regenerates the customer UUID.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 4.4.0 | 4.6.0 | 0.12.0 | 0.7.0 |
Deprecated in: | 4.11.0 | 5.1.0 | - | - |
Removed in: | - | - | 0.14.0 | 1.0.0 |
Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func signOut(mode: ClientSignOutMode) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
mode | ClientSignOutMode | yes | - | Mode of signing out |
Return Value:
No value is returned.
Example:
Client.signOut(mode: .signOutWithSessionDestroy)