getUserInfo method
Implementation
Future<LogtoUserInfoResponse> getUserInfo() async {
final httpClient = _httpClient ?? http.Client();
try {
final oidcConfig = await _getOidcConfig(httpClient);
final accessToken = await _tokenStorage.getAccessToken();
if (accessToken == null) {
throw LogtoAuthException(
LogtoAuthExceptions.authenticationError, 'not authenticated');
}
final userInfoResponse = await logto_core.fetchUserInfo(
httpClient: httpClient,
userInfoEndpoint: oidcConfig.userInfoEndpoint,
accessToken: accessToken.token,
);
return userInfoResponse;
} finally {
if (_httpClient == null) httpClient.close();
}
}