challenge method

Future<({String challengeToken})> challenge()

Requests a new authentication challenge token.

Authentication challenges are used to verify the authenticity of authentication requests and prevent replay attacks. The challenge token should be used in subsequent authentication calls.

Returns

A Future that resolves to a record containing the challenge token

Throws

  • HttpException if there's a network error
  • CalljmpException if the server returns an error

Example

final challenge = await calljmp.users.auth.challenge();
print('Challenge token: ${challenge.challengeToken}');

Implementation

Future<({String challengeToken})> challenge() => http
    .request("${_config.serviceUrl}/users/auth/challenge")
    .use(http.context(_config))
    .get()
    .json((json) => (challengeToken: json["challengeToken"]));