getAccessToken method
Implementation
Future<String> getAccessToken() async {
try {
final cognitoPlugin =
Amplify.Auth.getPlugin(AmplifyAuthCognito.pluginKey);
final session = await cognitoPlugin.fetchAuthSession();
final accessToken = session.userPoolTokensResult.value.accessToken.raw;
return accessToken;
} catch (e) {
_logger.captureException(
error: e,
stackTrace: StackTrace.current,
);
const authError = ServiceErrorType.authError;
throw ServiceException(ServiceErrorType.authError, authError.message);
}
}