diff --git a/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/actions/AuthorizationCognitoActions.kt b/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/actions/AuthorizationCognitoActions.kt index dc0e2c2b28..b0391c5c9a 100644 --- a/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/actions/AuthorizationCognitoActions.kt +++ b/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/actions/AuthorizationCognitoActions.kt @@ -105,7 +105,10 @@ internal object AuthorizationCognitoActions : AuthorizationActions { RefreshSessionEvent.EventType.RefreshUserPoolTokens(amplifyCredential.signedInData) ) is AmplifyCredential.IdentityPool -> RefreshSessionEvent( - RefreshSessionEvent.EventType.RefreshUnAuthSession(LoginsMapProvider.UnAuthLogins()) + RefreshSessionEvent.EventType.RefreshUnAuthSession( + amplifyCredential.identityId, + LoginsMapProvider.UnAuthLogins() + ) ) is AmplifyCredential.IdentityPoolFederated -> { AuthorizationEvent( diff --git a/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/events/RefreshSessionEvent.kt b/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/events/RefreshSessionEvent.kt index 1f31919834..b80328daf9 100644 --- a/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/events/RefreshSessionEvent.kt +++ b/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/events/RefreshSessionEvent.kt @@ -24,7 +24,7 @@ internal class RefreshSessionEvent(val eventType: EventType, override val time: sealed class EventType { data class RefreshUserPoolTokens(val signedInData: SignedInData) : EventType() data class RefreshAuthSession(val signedInData: SignedInData, val logins: LoginsMapProvider) : EventType() - data class RefreshUnAuthSession(val logins: LoginsMapProvider) : EventType() + data class RefreshUnAuthSession(val identityId: String, val logins: LoginsMapProvider) : EventType() data class Refreshed(val signedInData: SignedInData) : EventType() } diff --git a/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/RefreshSessionState.kt b/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/RefreshSessionState.kt index 3206887306..3708916419 100644 --- a/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/RefreshSessionState.kt +++ b/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/RefreshSessionState.kt @@ -87,8 +87,19 @@ internal sealed class RefreshSessionState : State { StateResolution(RefreshingUserPoolTokens(refreshSessionEvent.signedInData), listOf(action)) } is RefreshSessionEvent.EventType.RefreshUnAuthSession -> { - val action = fetchAuthSessionActions.refreshAuthSessionAction(refreshSessionEvent.logins) - StateResolution(RefreshingUnAuthSession(FetchAuthSessionState.NotStarted()), listOf(action)) + val action = fetchAuthSessionActions.fetchAWSCredentialsAction( + refreshSessionEvent.identityId, + refreshSessionEvent.logins + ) + StateResolution( + RefreshingUnAuthSession( + FetchAuthSessionState.FetchingAWSCredentials( + refreshSessionEvent.identityId, + refreshSessionEvent.logins + ) + ), + listOf(action) + ) } else -> defaultResolution }