getCertificates function

Future<PlayerCertificates> getCertificates(
  1. String accessToken
)

Gets certificates used to cryptographically sign chat messages since 1.19.

Implementation

Future<PlayerCertificates> getCertificates(String accessToken) async {
  final headers = {
    'authorization': 'Bearer $accessToken',
  };
  final response = await request(
      http.post, _minecraftServicesApi, '/player/certificates',
      headers: headers);

  if (response.statusCode == 401) {
    throw AuthException(AuthException.invalidCredentialsMessage);
  }
  final map = parseResponseMap(response);
  return PlayerCertificates(map);
}