IdTokenResult constructor

IdTokenResult(
  1. {required String token}
)

Constructs an IdTokenResult.

token The ID token string.

Parses the JWT and validates it's not empty.

Throws AuthUtils.authErrorHandler if token is empty.

Example:

final result = IdTokenResult(token: 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...');

Implementation

IdTokenResult({
  required String token,
})  : _parsedJwt = AuthUtils.parseJwt(token),
      _token = token {
  if (token.isEmpty) {
    throw AuthUtils.authErrorHandler(
        status: globals.ErrorMap[globals.ErrorCode.INVALID_ARGS] ?? 999,
        message: AuthErrorMessageTemplates.EMPTY_TOKEN);
  }
}