Closed adam-fpc closed 1 year ago
Hi @adam-fpc, in order to call fetchAuthSession
with getAwsCredentials = true
, you must have an identity pool associated with your account. Since it appears you only have a user pool, can you try calling with getAwsCredentials = false
or omitting the parameter entirely?
This is a divergence from Amplify 0.x
behavior in vNext, so apologies for any confusion there.
Hey @dnys1, thanks for clarifying. So in this scenario can a user no longer get the accessToken
, idToken
and refreshToken
?
They can. Here's how you would do that:
final session = await Amplify.Auth.fetchAuthSession() as CognitoAuthSession;
final tokens = session.userPoolTokens!;
final accessToken = tokens.accessToken;
final refreshToken = tokens.refreshToken;
final idToken = tokens.idToken;
Passing getAwsCredentials = true
is only necessary if you would like to retrieve temporary AWS credentials as well, which happens via an identity pool.
Got it! That makes sense now. Many thanks - will close this out.
Description
With a Cloudfront proxy in front of Cognito calling
Amplify.Auth.fetchAuthSession(options: const CognitoSessionOptions(getAWSCredentials: true))
after successfully authenticating throws an errorERROR | FetchAuthSessionStateMachine | Emitted error: InvalidAccountTypeException(message: No identity pool registered for this account, recoverySuggestion: Register an identity pool using the CLI or set getAWSCredentials to false, underlyingException: null)
A subsequent call to
updateUserAttributes
causes an app crash.Categories
Steps to Reproduce
Screenshots
No response
Platforms
Android Device/Emulator API Level
API 32+
Environment
Dependencies
Device
physical iPhone XR, iPhone 14 Simulator, Pixel 5 Simulator
OS
iOS 14.1, iOS 16.1, Android 12, Android 13
Deployment Method
Custom Pipeline
CLI Version
10.0.0
Additional Context
No response
Amplify Config
{ "UserAgent": "aws-amplify-cli/2.0", "Version": "1.0", "auth": { "plugins": { "awsCognitoAuthPlugin": { "UserAgent": "aws-amplify-cli/0.1.0", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "CognitoUserPool": { "Default": { "PoolId": "our poolId", "AppClientId": "our appClientId", "Endpoint": "proxy endpoint goes here", "Region": "our region" } }, "Auth": { "Default": { "authenticationFlowType": "USER_SRP_AUTH", "socialProviders": [], "usernameAttributes": [], "signupAttributes": [ "EMAIL" ], "passwordProtectionSettings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [ "REQUIRES_LOWERCASE", "REQUIRES_UPPERCASE", "REQUIRES_NUMBERS", "REQUIRES_SYMBOLS" ] }, "mfaConfiguration": "OPTIONAL", "mfaTypes": [ "SMS", "TOTP" ], "verificationMechanisms": [ "EMAIL" ] } } } } } }