AWS Cognito: Unauthenticated access is not supported for this identity pool.
The issue was resolved with an update by AWS with Swift 3 Support.
AWS / iOS / Cognito: unauthenticated access is not supported for this identity pool
The error you're getting is explaining the issue - you're sending a request to Cognito as an unauthenticated user, meaning no logins are included/linked to that identity, while it isn't enabled for the pool.
Unauthenticated identities are an opt in feature for an identity pool, you have to enable it while creating/editing your pool from the Cognito console.
iOS AWS API Gateway : Unauthenticated access is not supported for this identity pool
After 2 days, I figure it out.
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:CognitoIdentityUserPoolRegion
identityPoolId:CognitoIdentityPoolId identityProviderManager:pool];
Need to set identityProviderManager.
Thank you very much.
Unauthenticated access is not supported for this identity pool
We get this error when the Identity Pool has unauthenticated access disabled and no id token was found in the login map for the application. For example, in Android applications, after initializing CognitoCachingCredentialsProvider you also need to call the setLogins() method and provide a login map.
//Relevant imports
import com.amazonaws.auth.CognitoCachingCredentialsProvider;
import com.amazonaws.regions.Regions;
//Initialize credentials provider
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
getApplicationContext(),
"IDENTITY_POOL_ID",
Regions.US_EAST_1
);
//Create a login map
Map<String, String> logins = new HashMap<String, String>();
logins.put("www.amazon.com", "login with Amazon token");
//Set login map
credentialsProvider.setLogins(logins);
credentialsProvider.getCredentials();
//Create clients for AWS services with credentialsProvider as a parameter in the constructor
In the above example, I assumed that 'Login with Amazon' was used. For different providers, change the key "www.amazon.com" with the appropriate token. To know the key, just decode the id token at https://jwt.io and look for iss claim. The value without https:// will be the key for the login map.
As to where to put this code, check if it is using a CognitoCachingCredentialsProvider
object anywhere and then add a login map to it. To forcibily refresh credentials, call the refresh()
method
Related Topics
Updated Approach to Reauthenticate a User
Create a Weak Container in Swift That Accepts a Native Swift Protocol
Swift Generic Protocol Function Parameters
My Button Is Centered for iPhone 6 and 6 Plus, But Not for iPhone 5
Can the Byte Order of Double Be Safely Reversed
Swift 3 Errors with Additional Data
Ordering Firebase Posts Chronologically Swift
Swift MACos Popover Detect Change Dark Mode
How to Change Values Inside Array Without a Loop Swift
How to Know When to Call a Closure with () or Without Parentheses in Handler:
Custom Cell with Uitableview Inside Uicollectionviewcell
How to Display an Image by an API Url? Swift
Xctest Unit Test Data Response Not Set in Test After Viewdidload
Why Does Classa Adopting Protocolb Not Satisfy the Protocolb Requirement
Downloading Firebase Storage Files Device Issue
Node.Physicsbody.Joints Downcasting Error
Get All Documents at Once in a Completion Handler with Getdocuments in Firestore