authenticateConditionally method

Future<void> authenticateConditionally(
  1. IdentityProvider identityProvider,
  2. String tokenString, {
  3. required void onSuccess(
    1. ClientConditionalAuthResult
    ),
  4. required void onError(
    1. SyneriseError error
    ),
  5. ClientCondtitionalAuthContext? clientAuthContext,
  6. String? authID,
})

The function authenticateConditionally authenticates a user conditionally based on the provided identity provider, token string, client authentication context, and authentication ID.

Args: identityProvider (IdentityProvider): The identity provider is an object that represents the service or system responsible for authenticating users. It could be a third-party service like Google or Facebook, or it could be an internal authentication system. tokenString (String): The tokenString parameter is a string that represents the authentication token provided by the identity provider. clientAuthContext (ClientCondtitionalAuthContext): The clientAuthContext parameter is an optional parameter of type ClientConditionalAuthContext. It represents additional context information that can be used during the conditional authentication process. authID (String): The authID parameter is an optional string that represents the authentication ID. It is used to uniquely identify the authentication process.

Returns: The method is returning a Future object that resolves to a ClientConditionalAuthResult object.

Implementation

Future<void> authenticateConditionally(
    IdentityProvider identityProvider, String tokenString,
    {required void Function(ClientConditionalAuthResult) onSuccess,
    required void Function(SyneriseError error) onError,
    ClientCondtitionalAuthContext? clientAuthContext,
    String? authID}) async {
  SyneriseResult<ClientConditionalAuthResult> result =
      await _methods.authenticateConditionally(
          identityProvider, tokenString, clientAuthContext, authID);

  result.onSuccess((result) {
    onSuccess(result);
  }).onError((error) {
    onError(error);
  });
}