# setCredentials method

Future<Either<String, dynamic>> setCredentials({

1. required String user,
2. required String password,
3. required int clientIdentifier,

})

Sets the user credentials and stores them securely.

This method invokes a native method to set the credentials and, if successful, stores the credentials securely using a secure storage mechanism.

Parameters:

- `user`: The username to be set.
- `password`: The password to be set.
- `clientIdentifier`: The client identifier to be set.

Returns: A `Future` that resolves to an `Either` type containing a `String` on the left in case of an error, or a dynamic value on the right if the operation is successful.

## Implementation

    Future<Either<String, dynamic>> setCredentials({
      required String user,
      required String password,
      required int clientIdentifier,
    }) async {
      final response = await invokeNativeMethod('SmartfaceMobile.setCredentials', {
        'arg0': user,
        'arg1': password,
        'arg2': clientIdentifier,
      });

      if (response.isLeft() || !response.asRight) {
        return response;
      }

      await _secureStorageWrite(key: 'user', value: user);
      await _secureStorageWrite(key: 'password', value: password);
      await _secureStorageWrite(
        key: 'clientIdentifier',
        value: clientIdentifier.toString(),
      );
      return response;
    }