getAuthToken method

Future<GetAuthTokenResponseDto> getAuthToken(
  1. String username,
  2. String password
)

Implementation

Future<GetAuthTokenResponseDto> getAuthToken(String username,
    String password) async {
  final GetAuthTokenRequestDto dto = GetAuthTokenRequestDto(
      grantType: 'password',
      username: username,
      password: password,
      audience: _getAuth0Audience());

  final Map<String, dynamic> response = await ApiGatewayClient(_stage)
      .postAndParseJson(
      _getAuth0TokenApi, json.encode(dto.toJson()), _apiKey);

  final GetAuthTokenResponseDto responseDto = GetAuthTokenResponseDto
      .fromJson(response);

  return responseDto;
}