aws-amplify / amplify-swift

A declarative library for application development using cloud services.
Apache License 2.0
447 stars 194 forks source link

AuthError: Could not fetch AWS Credentials, AWS Cognito Identity Pool is not configured\nRecovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again\nCaused by:\ninvalidAccountTypeException #3784

Closed Vaibhav43 closed 4 weeks ago

Vaibhav43 commented 2 months ago

Describe the bug

Once user is logged in and after the token expires, it is not getting refreshed. It was working a week before.

Steps To Reproduce

Steps to reproduce the behavior:
1. Installed the latest Amplify SDK from SPM(v2.35.6)
2. Login with a valid user
3. After token expired try to generate new token using Amplify.Auth.fetchAuthSession(options: .forceRefresh())
4. The below error comes and the await doesnt responds back.

Expected behavior

New token should get generated and await should respond.

Amplify Framework Version

2.35.7

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

5.0

CLI version

12.12.4

Xcode version

Xcode 15.0 Build version 15A240d

Relevant log output

<details>
<summary>Log Messages</summary>

Starting execution for Auth.signInAPI
Starting execution
Check if authstate configured
Auth state configured
Validating current state
Signing with userSRP
Sending signIn event
Waiting for signin to complete
AWSCognitoAuthPlugin/IntializeSignInFlow.swift Starting execution
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signingIn" =         {
            "SignInState.notStarted" =             {
            };
        };
        "AuthorizationState.configured" =         {
        };
    };
}
Checking next step for: notStarted
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "+917310259832")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceMetadata
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceMetadata
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPools(["region": "<REDACTED>", "usernameAttributes": "[]", "signUpAttributes": "[]", "verificationMechanisms": "[]", "pinpointAppId": "(nil)", "endpoint": "N/A", "clientSecret": "18****vu", "passwordProtectionSettings": "nil", "poolId": "us-e****VuCp", "clientId": "6i98****7q4q", "hostedUI": "N/A"]), userPoolConfigData: Optional(["region": "<REDACTED>", "usernameAttributes": "[]", "signUpAttributes": "[]", "hostedUI": "N/A", "verificationMechanisms": "[]", "clientId": "6i98****7q4q", "clientSecret": "18****vu", "pinpointAppId": "(nil)", "endpoint": "N/A", "passwordProtectionSettings": "nil", "poolId": "us-e****VuCp"]), identityPoolConfigData: nil, authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["region": "<REDACTED>", "clientSecret": "18****vu", "usernameAttributes": "[]", "clientId": "6i98****7q4q", "endpoint": "N/A", "passwordProtectionSettings": "nil", "pinpointAppId": "(nil)", "hostedUI": "N/A", "signUpAttributes": "[]", "poolId": "us-e****VuCp", "verificationMechanisms": "[]"], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", gHexValue: "2"))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["region": "<REDACTED>", "clientSecret": "18****vu", "usernameAttributes": "[]", "clientId": "6i98****7q4q", "endpoint": "N/A", "passwordProtectionSettings": "nil", "pinpointAppId": "(nil)", "hostedUI": "N/A", "signUpAttributes": "[]", "poolId": "us-e****VuCp", "verificationMechanisms": "[]"], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: nil)), authorizationEnvironment: nil, credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.BroadcastLogger)
AWSCognitoAuthPlugin/IntializeSignInFlow.swift Sending event SignInEvent.initiateSignInWithSRP
AWSCognitoAuthPlugin/StartSRPFlow.swift Start execution
AWSCognitoAuthPlugin/StartSRPFlow.swift Sending event SignInEvent.initiateSignInWithSRP
AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signingIn" =         {
            "SignInState.signingInWithSRP" =             {
                "SRPSignInState.notStarted" =                 {
                };
                clientMetadata =                 {
                };
                password = "<REDACTED>";
                signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
                username = "+9*********32";
            };
        };
        "AuthorizationState.configured" =         {
        };
    };
}
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signingIn" =         {
            "SignInState.signingInWithSRP" =             {
                "SRPSignInState.initiatingSRPA" =                 {
                    clientMetadata =                     {
                    };
                    password = "<REDACTED>";
                    signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
                    username = "+9*********32";
                };
                clientMetadata =                 {
                };
                password = "<REDACTED>";
                signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
                username = "+9*********32";
            };
        };
        "AuthorizationState.configured" =         {
        };
    };
}
Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.notStarted, ["password": "<REDACTED>", "username": "+9*********32", "clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)])
Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.initiatingSRPA(["clientMetadata": [:], "username": "+9*********32", "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "password": "<REDACTED>"]), ["clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "username": "+9*********32", "password": "<REDACTED>"])
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "+917310259832")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceMetadata
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceMetadata
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "+917310259832")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceASF
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceASF
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
Credential Store state change:

{
    "CredentialStoreState.storingCredentials" =     {
    };
}
AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started setting `Data` for key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceASF
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Unable to find an existing item, creating new item
[KeychainStore] Successfully added `String` in keychain for key=amplify.us-east-1_nTBosVuCp.+917310259832.deviceASF
AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.success" =     {
        savedData = "AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId(\"65EF8C01-95A2-45E3-9535-06E117D5DF86\", \"+917310259832\")";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution
2024-07-18T11:52:13+0530 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 
 Path: / 
 Content-Type: application/x-amz-json-1.1, 
Content-Length: 6732, 
Host: cognito-idp.us-east-1.amazonaws.com, 
X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth, 
User-Agent: aws-sdk-swift/1.0 ua/2.0 api/cognito_identity_provider#1.0 os/ios#17.2.0 lang/swift#5.9 cfg/retry-mode#legacy 
 nil
AWSCognitoAuthPlugin/InitiateAuthSRP.swift InitiateAuth response success
AWSCognitoAuthPlugin/InitiateAuthSRP.swift Sending event SignInEvent(data: nil, id: "EBF768CB-3D80-401C-9B25-BD6B984A6C37", eventType: AWSCognitoAuthPlugin.SignInEvent.EventType.respondPasswordVerifier(["username": "+9*********32", "clientTimestamp": 2024-07-18 06:22:12 +0000, "NHexValue": "FF********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************FF", "srpKeyPair": "<privateKey 36************************************************************4F>, <publicKey CB********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************57>", "gHexValue": "*", "password": "<REDACTED>"], InitiateAuthOutput(authenticationResult: nil, challengeName: Optional(AWSCognitoIdentityProvider.CognitoIdentityProviderClientTypes.ChallengeNameType.passwordVerifier), challengeParameters: Optional(["USERNAME": "dcb1ef93-83dc-424e-914c-66eecd220cdb", "USER_ID_FOR_SRP": "dcb1ef93-83dc-424e-914c-66eecd220cdb", "SECRET_BLOCK": "OwATvJz550U66pYP8QlRR+J2/QOStXmGa+Frrkez+A83itShxuCzeEsDJIhODRmWgb1wAYrT+QU4U9mdEosUZvbC5yRmALtvnvs5W/Gx27mZjYmUMN7W7KVjlIWQm4HDrfVd+3f40FB8BohUV7ZQR+7pY80EWZydJ+ClDPpPlbJ/THUaorN1tgOmducmYKTQ5wFL7JgZ0GQloqkabDQ+2FACpAyOe4+GlSP9KegBYq2MILntBMgEVrixPf2YLtfHahRcm+4Gk8z8cP0UylSIb3wjd0O9+6++rnCFNxuMbxNNPPB9cEKn3CsT2rEvtJ6aEQDXJYvXy96oSQ3h7lCraz7hJI+nTpjmAYMZA0Ky0TMrtEbyeZWjXMxd+3Og05Gd21upZ5ba47pEuI3Zru+/EZEv0HIdxo1tS/S08v+ChOV0DtX6r0AHBG4jL2ql2tUJEcK8TG7/2n/TiEEWEIehDQapSQcO5BuwYB5tnv78Jp39nA3tkBjGqfw2ki/g78BhVztCFo2ZnK8tOtA243V/I9buzK6Yjb4JIU/XaiPkrg7K33N5+MksZIavDLUyTarw6xTBiRrF+hO97OqPLayIAtBJTYNu5Jp8Li8zk5zMq7rIpCVlvpgaK6aSzAnhiIJjZRI62vTAiPGC+yCHP1XMpWqF4WRv3H91zmr92ZIAM245/bc2Cj0L1mkG90lA34Sg4OG/SbFSS3qz9+M6zSMJM7iKUw+iACZCd93sn10G/GIgYMAg58Xetrd69fboTK0YupLRw503xvAGwE7GqaFL+ZDtoD5YMFb6VGIT3dHiP9Eum5bYlt9iIpiCjKgwTV0ZHWlK5G6avyX9Edp6P0UghX/G4GlnxJqf2YbJl6sfV9gyUjVdIiMk+aC5wdC97CLRzuvHcrxQ982oM4SiGBS9GEs+tcbH/4cPiI3X3RnuH7CzNOn7OuXJkpMkMYfBmUSSPnlDkgaNmrOA27+Sbkn7HyHHGSEAlk4yvwRlrgwRlrRtw5QSXicGefVsCa7BAZgmRIq3vDMXoG1e/qZZcrxbL2mcQJbzhqYQf9moDjp7LOClaI6Ghr5ViM2Wd1gTG5eSnj9ONBilhZC3a1ENkmBDeDk9pCJPf3G9Fgoin8n9p8cK4j/k1i/vyAkbbdZIpDwbg75lGw6PrFMTPzXVrytZGY8mSGOpISvL5/C3mB60pXJdom+LcGT60Hjse8p3WG3hE5TP2Zq86oWfoQooYfmE0uED9ORF2tdrLbxT6CTUVEVI9vFomGMsDMgdU6eUsXalparu1zMhz1V01PJbsEhMdOQVbAEc3JRXp1YdtNJAvGCBJqLkVP7Kj/adw9xmBR9zMMSpyDrKMwxyOXxHNRiIlzXhCX6xsQfWROSBc0AAqf6g7yargxbQBvA6PXTafmoSfna0HsAgdvTubpM94kvZQ7jqHpaWrvfAhugP418g/dsG68mPQo5GNOtD7btJVtEdmOESG6WgIF+YgWx2s9ORNEu/YoDak5EZ+98tHiJjF6cKvjS8DqPuqtSrm3KLBaL6/dtEEl2mfz1TzrphPcH0xTJuUbmHFcvBgKLfwDvHiLTaxTXaIXPdRBQQrKO/xXYQ1L0XrEb3FSunx6biA7YT9+0YT6dTU1ufRbhRLPNs1SybZc1LsdOIxXxtOli19yXq4Aiz21NWZ7KlG+G60g4V5b1TU+kwc/lpFzEpWbZW9GHDW9xQbD2GY7lxhg==", "SRP_B": "703031de308ee6ac7274a361449835a6e767b6d9b46ac25bf3a60d6d0c902f7b808947c48813b5319285dad51e985a6225b882a269a2e7fb3acf849a9f91da0cbc70201c3f7d0e4b3f55993eb6673fb44d0f36e05145214ac6492f4d3c9de518e1492b2ad1ba83252f7ac884cb7a918458c95b4d8645584f02417a8e6b8dc089b87ff6e53defa2db8072e427a1e612b96eae2af9ab17f1e853d175c92a0d37cda6b341cb3f0f19bb7a0bd01fd42d7c4a67ba2a0b792c8be004acef8007acda986490a6c7443e3bb2532ead018f9e6843b892f75860838af08c563996b41b58dea603eed933fd8d7b0ea1e8532849573e278a5fbe4793868f06c02949eab9d4f217b10fda6235d48f8895358418ae98383fef7be0e3ccebd345e8e6224c2a92af8e128213e6beecfafb470f2529f6090b7ec882e5d80a03ff0c2af78feebca800597f5cd6ba3190f27b6c20d21ba0c7a7c7a96ec1411f3a4cda5bc6514aa0f9bbceca5b821d7825026dd836e2d97e857610ef7c0f2b69770e2cfc15b0cf4fbc56", "SALT": "be53725ade79d2f84dab0e1fab0055fe"]), session: "CONTENT_REDACTED"), [:]), time: nil)
AWSCognitoAuthPlugin/VerifyPasswordSRP.swift Starting execution
Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.respondingPasswordVerifier(["password": "<REDACTED>", "clientTimestamp": 2024-07-18 06:22:12 +0000, "username": "+9*********32", "srpKeyPair": "<privateKey 36************************************************************4F>, <publicKey CB********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************57>", "NHexValue": "FF********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************FF", "gHexValue": "*"]), ["password": "<REDACTED>", "username": "+9*********32", "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "clientMetadata": [:]])
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signingIn" =         {
            "SignInState.signingInWithSRP" =             {
                "SRPSignInState.respondingPasswordVerifier" =                 {
                    NHexValue = "FF********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************FF";
                    clientTimestamp = "2024-07-18 06:22:12 +0000";
                    gHexValue = "*";
                    password = "<REDACTED>";
                    srpKeyPair = "<privateKey 36************************************************************4F>, <publicKey CB********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************57>";
                    username = "+9*********32";
                };
                clientMetadata =                 {
                };
                password = "<REDACTED>";
                signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
                username = "+9*********32";
            };
        };
        "AuthorizationState.configured" =         {
        };
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "dcb1ef93-83dc-424e-914c-66eecd220cdb")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "dcb1ef93-83dc-424e-914c-66eecd220cdb")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceASF
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceASF
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
Credential Store state change:

{
    "CredentialStoreState.storingCredentials" =     {
    };
}
AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started setting `Data` for key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceASF
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Unable to find an existing item, creating new item
[KeychainStore] Successfully added `String` in keychain for key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceASF
AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.success" =     {
        savedData = "AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId(\"A18ED049-BAC8-4484-B8D7-1D89B3E04359\", \"dcb1ef93-83dc-424e-914c-66eecd220cdb\")";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "dcb1ef93-83dc-424e-914c-66eecd220cdb")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPools(["usernameAttributes": "[]", "passwordProtectionSettings": "nil", "verificationMechanisms": "[]", "clientSecret": "18****vu", "endpoint": "N/A", "poolId": "us-e****VuCp", "signUpAttributes": "[]", "pinpointAppId": "(nil)", "region": "<REDACTED>", "hostedUI": "N/A", "clientId": "6i98****7q4q"]), userPoolConfigData: Optional(["signUpAttributes": "[]", "clientId": "6i98****7q4q", "hostedUI": "N/A", "passwordProtectionSettings": "nil", "pinpointAppId": "(nil)", "clientSecret": "18****vu", "verificationMechanisms": "[]", "usernameAttributes": "[]", "region": "<REDACTED>", "endpoint": "N/A", "poolId": "us-e****VuCp"]), identityPoolConfigData: nil, authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["poolId": "us-e****VuCp", "pinpointAppId": "(nil)", "passwordProtectionSettings": "nil", "usernameAttributes": "[]", "clientId": "6i98****7q4q", "region": "<REDACTED>", "clientSecret": "18****vu", "hostedUI": "N/A", "endpoint": "N/A", "signUpAttributes": "[]", "verificationMechanisms": "[]"], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", gHexValue: "2"))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["poolId": "us-e****VuCp", "pinpointAppId": "(nil)", "passwordProtectionSettings": "nil", "usernameAttributes": "[]", "clientId": "6i98****7q4q", "region": "<REDACTED>", "clientSecret": "18****vu", "hostedUI": "N/A", "endpoint": "N/A", "signUpAttributes": "[]", "verificationMechanisms": "[]"], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: nil)), authorizationEnvironment: nil, credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.BroadcastLogger)
2024-07-18T11:52:14+0530 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 
 Path: / 
 User-Agent: aws-sdk-swift/1.0 ua/2.0 api/cognito_identity_provider#1.0 os/ios#17.2.0 lang/swift#5.9 cfg/retry-mode#legacy, 
Host: cognito-idp.us-east-1.amazonaws.com, 
X-Amz-Target: AWSCognitoIdentityProviderService.RespondToAuthChallenge, 
Content-Type: application/x-amz-json-1.1, 
Content-Length: 7917 
 nil
AWSCognitoAuthPlugin/VerifyPasswordSRP.swift Sending event SignInEvent(data: nil, id: "6E481845-C6A3-49E2-B662-4DFE638443E9", eventType: AWSCognitoAuthPlugin.SignInEvent.EventType.finalizeSignIn(["userId": "dc********************************db", "signedInDate": 2024-07-18 06:22:14 +0000, "userName": "dc********************************db", "deviceMetadata": ["noData": "noData"], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "tokens": ["accessToken": "ey*****XQ", "idToken": "ey*****kQ", "expiry": 2024-07-18 06:32:14 +0000, "refreshToken": "ey*****Pg"]]), time: nil)
Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.signedIn(["userId": "dc********************************db", "tokens": ["idToken": "ey*****kQ", "accessToken": "ey*****XQ", "refreshToken": "ey*****Pg", "expiry": 2024-07-18 06:32:14 +0000], "signedInDate": 2024-07-18 06:22:14 +0000, "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "deviceMetadata": ["noData": "noData"], "userName": "dc********************************db"]), ["password": "<REDACTED>", "username": "+9*********32", "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "clientMetadata": [:]])
AWSCognitoAuthPlugin/SignInComplete.swift Starting execution
AWSCognitoAuthPlugin/SignInComplete.swift Sending event AuthenticationEvent.signInCompleted
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signingIn" =         {
            "SignInState.signingInWithSRP" =             {
                "SRPSignInState.signedIn" =                 {
                    deviceMetadata = "[\"noData\": \"noData\"]";
                    signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
                    signedInDate = "2024-07-18 06:22:14 +0000";
                    tokens = "[\"idToken\": \"ey*****kQ\", \"accessToken\": \"ey*****XQ\", \"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:14 +0000]";
                    userId = "dc********************************db";
                    userName = "dc********************************db";
                };
                clientMetadata =                 {
                };
                password = "<REDACTED>";
                signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
                username = "+9*********32";
            };
        };
        "AuthorizationState.configured" =         {
        };
    };
}
AWSCognitoAuthPlugin/InitializeFetchAuthSessionWithUserPool.swift Starting execution
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"idToken\": \"ey*****kQ\", \"accessToken\": \"ey*****XQ\", \"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:14 +0000]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.fetchingAuthSessionWithUserPool" =         {
            "FetchSessionState.notStarted" =             {
            };
        };
    };
}
AWSCognitoAuthPlugin/InitializeFetchAuthSessionWithUserPool.swift Sending event FetchAuthSessionEvent.throwError
AWSCognitoAuthPlugin/InformSessionError.swift Starting execution
AWSCognitoAuthPlugin/InformSessionError.swift Sending event AuthorizationEvent.receivedSessionError
AWSCognitoAuthPlugin/PersistCredentials.swift Starting execution
AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.storingCredentials" =     {
    };
}
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"expiry\": 2024-07-18 06:32:14 +0000, \"accessToken\": \"ey*****XQ\", \"refreshToken\": \"ey*****Pg\", \"idToken\": \"ey*****kQ\"]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.fetchingAuthSessionWithUserPool" =         {
            "FetchSessionState.error" =             {
                error = "AWSCognitoAuthPlugin.FetchSessionError.noIdentityPool";
            };
        };
    };
}
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"refreshToken\": \"ey*****Pg\", \"idToken\": \"ey*****kQ\", \"accessToken\": \"ey*****XQ\", \"expiry\": 2024-07-18 06:32:14 +0000]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.storingCredentials" = userPoolOnly;
    };
}
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started setting `Data` for key=amplify.us-east-1_nTBosVuCp.session
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Unable to find an existing item, creating new item
[KeychainStore] Successfully added `String` in keychain for key=amplify.us-east-1_nTBosVuCp.session
AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
AWSCognitoAuthPlugin/PersistCredentials.swift Sending event AuthorizationEvent.sessionEstablished
Credential Store state change:

{
    "CredentialStoreState.success" =     {
        savedData = "AWSCognitoAuthPlugin.CredentialStoreData.amplifyCredentials(userPoolOnly)";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
Received result
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:14 +0000, \"accessToken\": \"ey*****XQ\", \"idToken\": \"ey*****kQ\"]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.sessionEstablished" = userPoolOnly;
    };
}
Successfully completed execution for Auth.signInAPI with result:
AuthSignInResult(nextStep: Amplify.AuthSignInStep.done)
"Signin complete"
"signInUser: Login Successfull"

Starting execution for Auth.fetchSessionAPI
Starting execution
Check if authstate configured
Auth state configured
Fetching current state
Session exists, checking validity
Waiting for session to establish
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"idToken\": \"ey*****kQ\", \"accessToken\": \"ey*****XQ\", \"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:14 +0000]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.refreshingSession" =         {
            existing = userPoolOnly;
            refreshState =             {
                "RefreshSessionState.notStarted" =                 {
                };
            };
        };
    };
}
AWSCognitoAuthPlugin/InitializeRefreshSession.swift Starting execution
AWSCognitoAuthPlugin/InitializeRefreshSession.swift Sending event RefreshSessionEvent.refreshCognitoUserPool
AWSCognitoAuthPlugin/RefreshUserPoolTokens.swift Starting execution
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"accessToken\": \"ey*****XQ\", \"expiry\": 2024-07-18 06:32:14 +0000, \"idToken\": \"ey*****kQ\", \"refreshToken\": \"ey*****Pg\"]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.refreshingSession" =         {
            existing = userPoolOnly;
            refreshState =             {
                "RefreshSessionState.refreshingUserPoolToken" =                 {
                };
            };
        };
    };
}
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "dcb1ef93-83dc-424e-914c-66eecd220cdb")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPools(["verificationMechanisms": "[]", "passwordProtectionSettings": "nil", "hostedUI": "N/A", "region": "<REDACTED>", "poolId": "us-e****VuCp", "clientId": "6i98****7q4q", "clientSecret": "18****vu", "usernameAttributes": "[]", "signUpAttributes": "[]", "endpoint": "N/A", "pinpointAppId": "(nil)"]), userPoolConfigData: Optional(["verificationMechanisms": "[]", "passwordProtectionSettings": "nil", "hostedUI": "N/A", "region": "<REDACTED>", "poolId": "us-e****VuCp", "clientId": "6i98****7q4q", "clientSecret": "18****vu", "usernameAttributes": "[]", "signUpAttributes": "[]", "endpoint": "N/A", "pinpointAppId": "(nil)"]), identityPoolConfigData: nil, authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["usernameAttributes": "[]", "signUpAttributes": "[]", "verificationMechanisms": "[]", "region": "<REDACTED>", "pinpointAppId": "(nil)", "hostedUI": "N/A", "clientId": "6i98****7q4q", "poolId": "us-e****VuCp", "clientSecret": "18****vu", "passwordProtectionSettings": "nil", "endpoint": "N/A"], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", gHexValue: "2"))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["usernameAttributes": "[]", "signUpAttributes": "[]", "verificationMechanisms": "[]", "region": "<REDACTED>", "pinpointAppId": "(nil)", "hostedUI": "N/A", "clientId": "6i98****7q4q", "poolId": "us-e****VuCp", "clientSecret": "18****vu", "passwordProtectionSettings": "nil", "endpoint": "N/A"], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: nil)), authorizationEnvironment: nil, credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.BroadcastLogger)
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "dcb1ef93-83dc-424e-914c-66eecd220cdb")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
[KeychainStore] No Keychain item found for key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceMetadata
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.error" =     {
        errorType = "KeychainStoreError: Unable to find the keychain item";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
Credential Store state change:

{
    "CredentialStoreState.loadingStoredCredentials" =     {
    };
}
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "dcb1ef93-83dc-424e-914c-66eecd220cdb")
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
2024-07-18T11:52:27+0530 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 
 Path: / 
 Content-Length: 7767, 
X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth, 
Content-Type: application/x-amz-json-1.1, 
User-Agent: aws-sdk-swift/1.0 ua/2.0 api/cognito_identity_provider#1.0 os/ios#17.2.0 lang/swift#5.9 cfg/retry-mode#legacy, 
Host: cognito-idp.us-east-1.amazonaws.com 
 nil
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started retrieving `Data` from the store with key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceASF
[KeychainStore] Successfully retrieved `Data` from the store with key=amplify.us-east-1_nTBosVuCp.dcb1ef93-83dc-424e-914c-66eecd220cdb.deviceASF
AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.completedOperation
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
Credential Store state change:

{
    "CredentialStoreState.success" =     {
        savedData = "AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId(\"A18ED049-BAC8-4484-B8D7-1D89B3E04359\", \"dcb1ef93-83dc-424e-914c-66eecd220cdb\")";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
AWSCognitoAuthPlugin/RefreshUserPoolTokens.swift Starting initiate auth refresh token
AWSCognitoAuthPlugin/RefreshUserPoolTokens.swift Initiate auth response received
AWSCognitoAuthPlugin/RefreshUserPoolTokens.swift Sending event RefreshSessionEvent.refreshedCognitoUserPool
AWSCognitoAuthPlugin/InformSessionRefreshed.swift Starting execution
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"idToken\": \"ey*****kQ\", \"accessToken\": \"ey*****XQ\", \"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:14 +0000]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.refreshingSession" =         {
            existing = userPoolOnly;
            refreshState =             {
                "RefreshSessionState.refreshed" =                 {
                };
            };
        };
    };
}
AWSCognitoAuthPlugin/RefreshUserPoolTokens.swift Initiate auth complete
AWSCognitoAuthPlugin/InformSessionRefreshed.swift Sending event AuthorizationEvent.refreshed
AWSCognitoAuthPlugin/PersistCredentials.swift Starting execution
AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution
Credential Store state change:

{
    "CredentialStoreState.storingCredentials" =     {
    };
}
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:14 +0000, \"idToken\": \"ey*****kQ\", \"accessToken\": \"ey*****XQ\"]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.storingCredentials" = userPoolOnly;
    };
}
[KeychainStore] Initialized keychain with service=com.amplify.awsCognitoAuthPlugin, attributes=KeychainStoreAttributes(itemClass: "genp", service: "com.amplify.awsCognitoAuthPlugin", accessGroup: nil), accessGroup=
[KeychainStore] Started retrieving `Data` from the store with key=authConfiguration
[KeychainStore] Successfully retrieved `Data` from the store with key=authConfiguration
[KeychainStore] Started setting `Data` for key=authConfiguration
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=authConfiguration
[KeychainStore] Started setting `Data` for key=amplify.us-east-1_nTBosVuCp.session
[KeychainStore] Initialized fetching to decide whether update or add
[KeychainStore] Found existing item, updating
[KeychainStore] Successfully updated `String` in keychain for key=amplify.us-east-1_nTBosVuCp.session
AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation
AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
AWSCognitoAuthPlugin/PersistCredentials.swift Sending event AuthorizationEvent.sessionEstablished
Credential Store state change:

{
    "CredentialStoreState.success" =     {
        savedData = "AWSCognitoAuthPlugin.CredentialStoreData.amplifyCredentials(userPoolOnly)";
    };
}
Credential Store state change:

{
    "CredentialStoreState.idle" =     {
    };
}
Auth state change:

{
    "AuthState.configured" =     {
        "AuthenticationState.signedIn" =         {
            deviceMetadata = "[\"noData\": \"noData\"]";
            signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)";
            signedInDate = "2024-07-18 06:22:14 +0000";
            tokens = "[\"idToken\": \"ey*****kQ\", \"accessToken\": \"ey*****XQ\", \"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:14 +0000]";
            userId = "dc********************************db";
            userName = "dc********************************db";
        };
        "AuthorizationState.sessionEstablished" = userPoolOnly;
    };
}
Successfully completed execution for Auth.fetchSessionAPI with result:
{
    awsCredentialsError = "AuthError: Could not fetch AWS Credentials, AWS Cognito Identity Pool is not configured\nRecovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again\nCaused by:\ninvalidAccountTypeException";
    cognitoTokens = "[\"idToken\": \"ey*****LA\", \"refreshToken\": \"ey*****Pg\", \"expiry\": 2024-07-18 06:32:27 +0000, \"accessToken\": \"ey*****Vg\"]";
    identityIdError = "AuthError: Could not fetch identity Id, AWS Cognito Identity Pool is not configured\nRecovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again\nCaused by:\ninvalidAccountTypeException";
    isSignedIn = true;
    userSub = "dcb1e*****20cdb";
}



### Is this a regression?

Yes

### Regression additional context

_No response_

### Platforms

iOS

### OS Version

iOS 17.2

### Device

iPhone 15

### Specific to simulators

No

### Additional context

_No response_
harsh62 commented 2 months ago

The error says that you don't have any identity pool. Can you share your amplifyconfiguration.json or amplify_output.json redacted all the sensitive information .

Vaibhav43 commented 2 months ago

@harsh62 Please find the file.

awsconfiguration.json { "UserAgent": "aws-amplify/cli", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "CognitoUserPool": { "Default": { "PoolId": "us-east-1-**********", "AppClientId": "******************************", "AppClientSecret": "**************************************************", "Region": "us-east-1" } }, "Auth": { "Default": { "authenticationFlowType": "USER_SRP_AUTH" } } }

{ "UserAgent": "aws-amplify-cli/2.0", "Version": "1.0", "auth": { "plugins": { "awsCognitoAuthPlugin": { "UserAgent": "aws-amplify/cli", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "CognitoUserPool": { "Default": { "PoolId": "us-east-1-**************", "AppClientId": "****************************", "AppClientSecret": "********************************************************", "Region": "us-east-1" } }, "Auth": { "Default": { "authenticationFlowType": "USER_SRP_AUTH" } } } } } }

harsh62 commented 2 months ago

@Vaibhav43 There is no identity pool configuration. So the error is expected. Can you share your code and use case that you are trying to achieve?

Vaibhav43 commented 2 months ago

In our case we are using the User Pool.

  1. The User is logged in in the app
  2. Once the id token expires after 1 hour, we try to refresh the token using Amplify.Auth.fetchAuthSession.
  3. In this i am getting the error

`{ let session = try await Amplify.Auth.fetchAuthSession(options: .forceRefresh())

            // Get cognito user pool token
            if let cognitoTokenProvider = session as? AWSAuthCognitoSession {
                let tokens = try cognitoTokenProvider.getCognitoTokens().get()
                debugPrint("Id token - Id token - \(tokens.idToken)")
                debugPrint("Session Id - \(UserDefaultsClass.get(key: .sessionId) as? String ?? "")")
                var expirationDate = Date().add(components: [.minute], values: [55])
                if let tokenExpirationDate = try? AWSAuthService().getTokenClaims(tokenString: tokens.idToken).get()["exp"]?.doubleValue {
                    let date = Int64(tokenExpirationDate*1000).toDate
                    expirationDate = date
                }
                let isTokenAlreadySaved = UserDefaultsClass.isAvailable(key: .accessToken)
                if isTokenAlreadySaved {
                    completion?(tokens.idToken, expirationDate)
                } else {

                    AppManager.updateTokenInDb(token: tokens.idToken, accessTokenExpirationDate: expirationDate)
                    completion?(tokens.idToken, expirationDate)
                }
            }
            else{
                completion?(nil, nil)
            }
        }`

Successfully completed execution for Auth.fetchSessionAPI with result: { awsCredentialsError = "AuthError: Could not fetch AWS Credentials, AWS Cognito Identity Pool is not configured\nRecovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again\nCaused by:\ninvalidAccountTypeException"; cognitoTokens = "[\"accessToken\": \"ey*****Og\", \"refreshToken\": \"ey*****UA\", \"idToken\": \"ey*****lg\", \"expiry\": 2024-07-19 05:57:33 +0000]"; identityIdError = "AuthError: Could not fetch identity Id, AWS Cognito Identity Pool is not configured\nRecovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again\nCaused by:\ninvalidAccountTypeException"; isSignedIn = true; userSub = "2ed9e*****b75e8"; }

harsh62 commented 2 months ago

Well from the logs I can see that the tokens have values which seem to be correct..

cognitoTokens = "[\"accessToken\": \"ey*****Og\", \"refreshToken\": \"ey*****UA\", \"idToken\": \"ey*****lg\", \"expiry\": 2024-07-19 05:57:33 +0000]";

Furthermore, the error that you see is related to Cognito Identity, which is expected, since you don't have identity pool configured.

github-actions[bot] commented 4 weeks ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.