loginOAuthIdToken method

Implementation

Future<LoginOauthIdTokenResponse> loginOAuthIdToken(LoginOauthIdTokenRequest params) async {
  final url = Uri.parse('${_wepinBaseUrl}user/oauth/login/id-token');
  final jsonRequestBody = jsonEncode(params.toJson());
  final response = await http.post(
    url,
    headers: headers,
    body: jsonRequestBody,
  );

  if (response.statusCode >= 200 && response.statusCode < 300) {
    final responseBody = jsonDecode(response.body);
    return LoginOauthIdTokenResponse.fromJson(responseBody);
  } else {
    throw WepinError(WepinErrorCode.apiRequestError, 'code: ${response.statusCode} , body: ${response.body}');
  }
}