getChallengeResponse method

Future<ChallengeResponse> getChallengeResponse (
  1. String accountId,
  2. [String homeDomain,
  3. String clientDomain]
)

Implementation

Future<ChallengeResponse> getChallengeResponse(String accountId,
    [String homeDomain, String clientDomain]) async {
  String id = checkNotNull(accountId, "accountId can not be null");

  Uri serverURI = Uri.parse(_authEndpoint);
  try {
    _ChallengeRequestBuilder requestBuilder =
        new _ChallengeRequestBuilder(httpClient, serverURI);
    ChallengeResponse response = await requestBuilder
        .forAccountId(id)
        .forHomeDomain(homeDomain)
        .forClientDomain(clientDomain)
        .execute();
    return response;
  } catch (e) {
    if (e is ErrorResponse) {
      throw new ChallengeRequestErrorResponse(e.code, e.body);
    } else {
      throw e;
    }
  }
}