updateAuth method

  1. @Deprecated("Shutdown SDK instead.")
  2. @override
Future<MoveAuthError?> updateAuth(
  1. MoveAuth moveAuth
)
override

Updates the user's provided Auth upon its expiry. Auth expiry triggers the SDK Auth State change listener.

Warning:

  • Only the user's token is expected to update. Changing any other user's auth param will fail with MoveAuthError.authInvalid. moveAuth must contain new valid authentication data. Returns an errror if failed.

Implementation

@Deprecated("Shutdown SDK instead.")
@override
Future<MoveAuthError?> updateAuth(MoveAuth moveAuth) async {
  try {
    await methodChannel.invokeMethod(
      'updateAuth',
      <String, dynamic>{
        'projectId': moveAuth.projectId,
        'accessToken': moveAuth.accessToken,
        'userId': moveAuth.userId,
        'refreshToken': moveAuth.refreshToken,
      },
    );
  } on PlatformException catch (e) {
    switch (e.code) {
      case "authInvalid":
        return MoveAuthError.authInvalid;
      case "serviceUnreachable":
        return MoveAuthError.serviceUnreachable;
      case "throttle":
        return MoveAuthError.throttle;
    }
  }

  return null;
}