fetchUserInfo function

Future<LogtoUserInfoResponse> fetchUserInfo({
  1. required Client httpClient,
  2. required String userInfoEndpoint,
  3. required String accessToken,
})

Implementation

Future<LogtoUserInfoResponse> fetchUserInfo(
    {required http.Client httpClient,
    required String userInfoEndpoint,
    required String accessToken}) async {
  final response = await httpClient.post(Uri.parse(userInfoEndpoint),
      headers: {'Authorization': 'Bearer $accessToken'});

  var body = httpResponseHandler(response);

  return LogtoUserInfoResponse.fromJson(body);
}