getIdToken method

Future<IdTokenResult?> getIdToken({
  1. bool refresh = false,
})

Obtains the id token result for the current user, forcing a refresh if desired.

Useful when authenticating against your own backend. Use our server SDKs or follow the official documentation to securely verify the integrity and validity of this token.

Completes with an error if the user is signed out.

Implementation

Future<IdTokenResult?> getIdToken({bool refresh = false}) async {
  IdTokenResult? result;
  try {
    result = await _user?.getIdTokenResult(refresh);
  } catch (ex) {
    setError(ex);
    result = null;
  }
  return result;
}