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 casting the result of fetchAuthSession as follows:

<BlockSwitcher>
<Block name="Java">

```java
Amplify.Auth.fetchAuthSession(
    result -> {
        AWSCognitoAuthSession cognitoAuthSession = (AWSCognitoAuthSession) result;
            switch(cognitoAuthSession.getIdentityIdResult().getType()) {
                case SUCCESS:
                    Log.i("AuthQuickStart", "IdentityId: " + cognitoAuthSession.getIdentityIdResult().getValue());
                    break;
                case FAILURE:
                    Log.i("AuthQuickStart", "IdentityId not present because: " + cognitoAuthSession.getIdentityIdResult().getError().toString());
            }
        },
        error -> Log.e("AuthQuickStart", error.toString())
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
Amplify.Auth.fetchAuthSession(
    {
        val session = it as AWSCognitoAuthSession
        when (session.identityIdResult.type) {
            AuthSessionResult.Type.SUCCESS ->
                Log.i("AuthQuickStart", "IdentityId = ${session.identityIdResult.value}")
            AuthSessionResult.Type.FAILURE ->
                Log.w("AuthQuickStart", "IdentityId not found", session.identityIdResult.error)
        }
    },
    { Log.e("AuthQuickStart", "Failed to fetch session", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
try {
    val session = Amplify.Auth.fetchAuthSession() as AWSCognitoAuthSession
    val id = session.identityIdResult
    if (id.type == AuthSessionResult.Type.SUCCESS) {
        Log.i("AuthQuickStart", "IdentityId: ${id.value}")
    } else if (id.type == AuthSessionResult.Type.FAILURE) {
        Log.i("AuthQuickStart", "IdentityId not present: ${id.error}")
    }
} catch (error: AuthException) {
    Log.e("AuthQuickStart", "Failed to fetch session", error)
}
```

</Block>
<Block name="RxJava">

```java
RxAmplify.Auth.fetchAuthSession()
    .subscribe(
        result -> {
            AWSCognitoAuthSession cognitoAuthSession = (AWSCognitoAuthSession) result;

            switch (cognitoAuthSession.getIdentityIdResult().getType()) {
                case SUCCESS:
                    Log.i("AuthQuickStart", "IdentityId: " + cognitoAuthSession.getIdentityIdResult().getValue());
                    break;
                case FAILURE:
                    Log.i("AuthQuickStart", "IdentityId not present because: " + cognitoAuthSession.getIdentityIdResult().getError().toString());
            }
        },
        error -> Log.e("AuthQuickStart", error.toString())
    );
```

</Block>
</BlockSwitcher>

## Force refreshing session

You can ask the plugin to force refresh the internal session by setting the `forceRefresh` option when calling the fetchAuthSession API.

<BlockSwitcher>
<Block name="Java">

```java
AuthFetchSessionOptions options = AuthFetchSessionOptions.builder().forceRefresh(true).build();
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
val option = AuthFetchSessionOptions.builder().forceRefresh(true).build()
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
val option = AuthFetchSessionOptions.builder().forceRefresh(true).build()
```

</Block>
<Block name="RxJava">

```java
AuthFetchSessionOptions options = AuthFetchSessionOptions.builder().forceRefresh(true).build();
```

</Block>
</BlockSwitcher>
