getProfile method
Implementation
@override
Future<dynamic> getProfile(String accessToken) async {
try {
final profileUrl = _getProfileUrl();
final response = await html.HttpRequest.request(
profileUrl,
method: 'GET',
requestHeaders: {
'Authorization': 'Bearer $accessToken',
'Accept': 'application/json',
},
);
if (response.status == 200) {
return response.responseText!;
} else {
throw PlatformException(
code: 'HTTP_ERROR',
message: 'HTTP ${response.status}: ${response.responseText}',
);
}
} catch (e) {
throw PlatformException(
code: 'PROFILE_ERROR',
message: e.toString(),
);
}
}