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.
The API key must have the SAUTH_REGISTER_CLIENT_CREATE permission from the Client group.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> registerAccount(ClientAccountRegisterContext context, {required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| context | ClientAccountRegisterContext | yes | - | Object with the customer's email, password, and other optional data |
| onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
ClientAccountRegisterContext clientAccountRegisterContext = ClientAccountRegisterContext(email: email, password: password);
await Synerise.client.registerAccount(clientAccountRegisterContext, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> registerAccount(ClientAccountRegisterContext context) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| context | ClientAccountRegisterContext | yes | - | Object with the customer's email, password, and other optional data |
Return Value:
No value is returned.
Example:
await Synerise.client.registerAccount(clientAccountRegisterContext).catchError((error)
Request customer account activation
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.
The API key must have the SAUTH_CONFIRMATION_CLIENT_CREATE permission from the Client group.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> requestAccountActivation(String email,
{required void Function() onSuccess,
required void Function(SyneriseError error) onError}) async
Before version 2.0.0, this method was called activateAccount
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| String | yes | - | Customer’s email | |
| onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.client.synerise-flutter-sdkAccount(email, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> activateAccount(String email) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| String | yes | - | Customer’s email |
Return Value:
No value is returned.
Example:
await Synerise.client.activateAccount(email).catchError((error)
Confirm customer account activation
This method confirms a customer account with the confirmation token.
This method is a global operation and doesn't require customer authentication.
Returns the HTTP 400 status code if the account is already confirmed or 404 if the account does not exist.
The API key must have the SAUTH_CONFIRMATION_CLIENT_CREATE permission from the Client group.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> confirmAccountActivation(String token, {required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Before version 1.0.0, this method was called confirmAccount.
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| token | String | yes | - | Customer’s token provided by email |
| onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.client.confirmAccountActivation(token, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> confirmAccountActivation(String token) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| token | String | yes | - | Customer’s token provided by email |
Return Value:
No value is returned.
Example:
await Synerise.client.confirmAccount(token).catchError((error)
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.
The API key must have the SAUTH_PIN_CODE_RESEND_CLIENT_CREATE permission from the Client group.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> requestAccountActivationByPin(String email, {required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| String | yes | Customer's email | |
| onSuccess | Function() | yes | - |
| onError | Function(SyneriseError error) | yes | - |
Return Value:
No value is returned.
Example:
await Synerise.client.requestAccountActivationByPin(email, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> requestAccountActivationByPin(String email) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| String | yes | Customer's email |
Return Value:
No value is returned.
Example:
await Synerise.client.requestAccountActivationByPin(email).catchError((error) {
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.
The API key must have the SAUTH_PIN_CODE_RESEND_CLIENT_CREATE permission from the Client group.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> confirmAccountActivationByPin(String email, String pinCode, {required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| pinCode | String | yes | Code sent to a customer's email |
| String | yes | Customer's email | |
| onSuccess | Function() | yes | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.client.confirmAccountActivationByPin(email, pinCode, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> confirmAccountActivationByPin(String email, String pinCode) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| pinCode | String | yes | Code sent to a customer's email |
| String | yes | Customer's email |
Return Value:
No value is returned.
Example:
await Synerise.client.confirmAccountActivationByPin(email, pinCode).catchError((error) {
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:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> signIn(String email, String password, {required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| String | yes | - | Customer’s email | |
| password | String | yes | - | Customer’s password |
| onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.client.signIn(email, password, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> signIn(String email, String password) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| String | yes | - | Customer’s email | |
| password | String | yes | - | Customer’s password |
Return Value:
No value is returned.
Example:
await Synerise.client.signIn(email,password).catchError((error)
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: | ||||
| lib/modules/client/client_impl.dart |
Related To:
ClientConditionalAuthResult
Class:
ClientImpl
Declaration:
Future<void> signInConditionally(String email, String password,
{required void Function(ClientConditionalAuthResult) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| String | yes | Customer's email | |
| password | String | yes | Customer's password |
Return Value:
No value is returned.
Example:
await Synerise.client.signInConditionally(email, password, onSuccess: (ClientConditionalAuthResult result) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<ClientConditionalAuthResult> signInConditionally(String email, String password) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| String | yes | Customer's email | |
| password | String | yes | Customer's password |
Return Value:
ClientConditionalAuthResult
Example:
await Synerise.client.signInConditionally(email, password).catchError((error)
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: | ||||
| lib/modules/client/client_impl.dart |
Related To:
ClientAuthContext
ClientIdentityProvider
Class:
ClientImpl
Declaration:
Future<void> authenticate(ClientAuthContext clientAuthContext, IdentityProvider identityProvider, String tokenString,
{required void Function(bool) onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| clientAuthContext | ClientAuthContext | yes | - | Object which contains agreements, attributes, and identifier of authorization |
| identityProvider | ClientIdentityProvider | yes | - | Provider of your token |
| tokenString | String | yes | - | Token retrieved from provider |
| onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.client.authenticate(clientAuthContext, identityProvider, tokenString, onSuccess: (bool result) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<bool> authenticate(ClientAuthContext clientAuthContext, IdentityProvider identityProvider, String tokenString) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| clientAuthContext | ClientAuthContext | yes | - | Object which contains agreements, attributes, and identifier of authorization |
| identityProvider | ClientIdentityProvider | yes | - | Provider of your token |
| tokenString | String | yes | - | Token retrieved from provider |
Return Value:
true if the operation is success, otherwise it throws an error.
Example:
await Synerise.client.authenticate(clientAuthContext, identityProvider, tokenString).catchError((error)
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: | ||||
| lib/modules/client/client_impl.dart |
Related To:
ClientConditionalAuthResult
ClientIdentityProvider
Class:
ClientImpl
Declaration:
Future<void> authenticateConditionally(ClientAuthContext clientAuthContext, IdentityProvider identityProvider, String tokenString,
{String? authID, required void Function(ClientConditionalAuthResult) onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Optional | Description |
|---|---|---|---|
| clientAuthContext | ClientAuthContext | no | Object which contains agreements and attributes |
| identityProvider | ClientIdentityProvider | no | Provider of your token |
| tokenString | String | no | Token retrieved from provider |
| authID | String | yes | Optional identifier of authorization |
| onSuccess | Function(ClientConditionalAuthResult result) | yes | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | Function to be executed when the operation is completed with an error |
authID parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer.
Return Value:
No value is returned.
Example:
Token token = Token(tokenString: "tokenString", origin: TokenOrigin.anonymous, expirationDate: DateTime;
await Synerise.client.retrieveToken(onSuccess: (Token token) {
token = token;
}, onError: (SyneriseError error) {
//onError handling
});
String tokenString = token.tokenString;
IdentityProvider identityProvider = IdentityProvider.oauth;
await Synerise.client.authenticateConditionally(identityProvider, tokenString, onSuccess: (ClientConditionalAuthResult result) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<ClientConditionalAuthResult> authenticateConditionally(ClientAuthContext clientAuthContext, IdentityProvider identityProvider, String tokenString) async
Parameters:
| Parameter | Type | Optional | Description |
|---|---|---|---|
| token | String | no | Token retrieved from provider |
| clientIdentityProvider | ClientIdentityProvider | no | Provider of your token |
| authID | String | yes | Optional identifier of authorization |
| context | ClientConditionalAuthContext | no | Object which contains agreements and attributes |
authID parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer.
Return Value:
ClientConditionalAuthResult
Example:
ClientAgreements? agreements = ClientAgreements(push: false, rfid: false, wifi: false);
Map<String, Object>? attributes;
ClientAuthContext clientAuthContext = ClientAuthContext(authId: 'AUTH_ID', agreements: agreements, attributes: attributes);
Token token = await Synerise.client.retrieveToken().catchError((error) {
String errorMessage = Utils.handlePlatformException(error);
Utils.displaySimpleAlert("error on handling api call \n $errorMessage", context);
throw Exception(errorMessage);
});
String tokenString = token.tokenString;
IdentityProvider identityProvider = IdentityProvider.oauth;
ClientConditionalAuthResult result =
await Synerise.client.authenticateConditionally(clientAuthContext, identityProvider, tokenString).catchError((error) {
String errorMessage = Utils.handlePlatformException(error);
Utils.displaySimpleAlert("error on handling api call: you need to be signed in to authenticate \n $errorMessage", context);
throw Exception(errorMessage);
});
Authenticate customer via Simple Profile Authentication
This method authenticates a customer with Simple Profile Authentication.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 4.14.0 | 5.7.1 | 0.15.0 | 0.7.0 |
When you use this method, you must set a request validation salt by using the Synerise.setRequestValidationSalt(_:) method (if salt is enabled for Simple Profile Authentication).
The API key must have the SAUTH_SIMPLE_AUTH_CREATE from the Auth group.
Declared In:
lib/modules/client/client_impl.dart
Related To:
ClientSimpleAuthenticationData
Class:
ClientImpl
Declaration:
Future<void> simpleAuthentication(ClientSimpleAuthenticationData data, String authID, {required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| data | ClientSimpleAuthenticationData | yes | Object which contains customer data |
| authID | String | yes | Required identifier of authorization |
| onSuccess | Function() | yes | - |
| onError | Function(SyneriseError error) | yes | - |
authID parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer.
Return Value:
No value is returned.
Example:
ClientSimpleAuthenticationData data =
ClientSimpleAuthenticationData(firstName: firstName, lastName: lastName, email: email, customId: customID);
await Synerise.client.simpleAuthentication(data, authID, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> simpleAuthentication(ClientSimpleAuthenticationData clientSimpleAuthenticationData, String authID) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| data | ClientSimpleAuthenticationData | yes | - | Object which contains customer data |
| authID | String | yes | null | Required identifier of authorization |
authID parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer.
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 Synerise Authentication - RaaS, OAuth, Facebook, Apple).
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<bool> isSignedIn() async
Return Value:
true if the customer is signed in, otherwise returns false.
Example:
bool isSignedInBool = await Synerise.client.isSignedIn();
Check if a customer is signed in (via Simple Profile Authentication)
This method checks if a customer is signed in (via Simple Profile 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: | ||||
| lib/modules/client/client_impl.dart |
Class:
Client
Declaration:
Future<bool> isSignedInViaSimpleAuthentication() async
Return Value:
true if the customer is signed in (via Simple Profile Authentication), otherwise returns false.
Example:
await Synerise.client
.isSignedInViaSimpleAuthentication()
.then((bool result) {
if (result == true) {
//result handling
} else {
//error handling
}
});
Sign out a customer
This method signs out a customer out.
This method works with every authentication type (via Synerise, External Provider, OAuth or Simple Profile Authentication).
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> signOut() async
Return Value:
No value is returned.
Example:
Synerise.client.signOut().whenComplete(() => {
//onSuccess handling
});
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:
.signOutmode signs out the customer..signOutWithSessionDestroymode 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 |
This method works with every authentication type (via Synerise, External Provider, OAuth or Simple Profile Authentication).
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> signOutWithMode(ClientSignOutMode mode, bool fromAllDevices, {required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| mode | ClientSignOutMode | yes | Mode of signing out |
| fromAllDevices | bool | yes | Determines if the method should sign out all devices |
| onSuccess | Function() | yes | - |
| onError | Function(SyneriseError error) | yes | - |
Return Value:
No value is returned.
Example:
ClientSignOutMode mode = ClientSignOutMode.signOutWithSessionDestroy;
bool fromAllDevices = true;
await Synerise.client.signOutWithMode(mode, fromAllDevices, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> signOutWithMode(ClientSignOutMode mode, bool fromAllDevices) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| mode | ClientSignOutMode | yes | Mode of signing out |
| fromAllDevices | bool | yes | Determines if the method should sign out all devices |
Return Value:
No value is returned.
Example:
ClientSignOutMode mode = ClientSignOutMode.signOutWithSessionDestroy;
bool fromAllDevices = true;
await Synerise.client.signOutWithMode(mode, fromAllDevices).catchError((error) {