However, if you need to access them in relation to working with an API outside Amplify or want access to AWS specific identifying information (e.g. IdentityId), you can access these implementation details by calling fetchAuthSession on the Cognito Auth Plugin. This will return a `CognitoAuthSession`, which has additional attributes compared to `AuthSession`, which is typically returned by fetchAuthSession. See the example below:

```dart
Future<void> fetchAuthSession() async {
  try {
    final result = await Amplify.Auth.fetchAuthSession();
    safePrint('User is signed in: ${result.isSignedIn}');
  } on AuthException catch (e) {
    safePrint('Error retrieving auth session: ${e.message}');
  }
}
```

### Retrieving AWS credentials

Sometimes it can be helpful to retrieve the instance of the underlying plugin
which has more specific typing. In the case of Cognito, calling `fetchAuthSession`
on the Cognito plugin returns AWS-specific values such as the identity ID,
AWS credentials, and Cognito User Pool tokens.

```dart
Future<void> fetchCognitoAuthSession() async {
  try {
    final cognitoPlugin = Amplify.Auth.getPlugin(AmplifyAuthCognito.pluginKey);
    final result = await cognitoPlugin.fetchAuthSession();
    final identityId = result.identityIdResult.value;
    safePrint("Current user's identity ID: $identityId");
  } on AuthException catch (e) {
    safePrint('Error retrieving auth session: ${e.message}');
  }
}
```
