signup method

Future<AuthToken> signup({
  1. required ProfileSignupRequest profile,
  2. String? redirectUrl,
  3. List<ScopeValue>? scope,
})

Create and authenticate a new user with the specified data.

Implementation

Future<AuthToken> signup({
  required ProfileSignupRequest profile,
  String? redirectUrl,
  List<ScopeValue>? scope,
}) async {
  try {
    final authTokenInterface = await _platform.signup(
      reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey),
      profile: ProfileSignupRequestConverter.toInterface(profile),
      redirectUrl: redirectUrl,
      scope: scope?.map(ScopeValueConverter.toInterface).toList(),
    );

    final authToken = AuthTokenConverter.fromInterface(authTokenInterface);

    return authToken;
  } catch (error, stackTrace) {
    try {
      _platform.parseError(error, stackTrace);
    } catch (interfaceError, interfaceStackTrace) {
      adaptErrors(
        error: interfaceError,
        stackTrace: interfaceStackTrace,
      );
    }
  }
}