createIdentityPool method
- required bool allowUnauthenticatedIdentities,
- required String identityPoolName,
- bool? allowClassicFlow,
- List<
CognitoIdentityProvider> ? cognitoIdentityProviders, - String? developerProviderName,
- Map<
String, String> ? identityPoolTags, - List<
String> ? openIdConnectProviderARNs, - List<
String> ? samlProviderARNs, - Map<
String, String> ? supportedLoginProviders,
Creates a new identity pool. The identity pool is a store of user identity
information that is specific to your AWS account. The keys for
SupportedLoginProviders
are as follows:
-
Facebook:
graph.facebook.com
-
Google:
accounts.google.com
-
Amazon:
www.amazon.com
-
Twitter:
api.twitter.com
-
Digits:
www.digits.com
May throw InvalidParameterException. May throw NotAuthorizedException. May throw ResourceConflictException. May throw TooManyRequestsException. May throw InternalErrorException. May throw LimitExceededException.
Parameter allowUnauthenticatedIdentities
:
TRUE if the identity pool supports unauthenticated logins.
Parameter identityPoolName
:
A string that you provide.
Parameter allowClassicFlow
:
Enables or disables the Basic (Classic) authentication flow. For more
information, see Identity
Pools (Federated Identities) Authentication Flow in the Amazon
Cognito Developer Guide.
Parameter cognitoIdentityProviders
:
An array of Amazon Cognito user pools and their client IDs.
Parameter developerProviderName
:
The "domain" by which Cognito will refer to your users. This name acts as
a placeholder that allows your backend and the Cognito service to
communicate about the developer provider. For the
DeveloperProviderName
, you can use letters as well as period
(.
), underscore (_
), and dash (-
).
Once you have set a developer provider name, you cannot change it. Please take care in setting this parameter.
Parameter identityPoolTags
:
Tags to assign to the identity pool. A tag is a label that you can apply
to identity pools to categorize and manage them in different ways, such as
by purpose, owner, environment, or other criteria.
Parameter openIdConnectProviderARNs
:
A list of OpendID Connect provider ARNs.
Parameter samlProviderARNs
:
An array of Amazon Resource Names (ARNs) of the SAML provider for your
identity pool.
Parameter supportedLoginProviders
:
Optional key:value pairs mapping provider names to provider app IDs.
Implementation
Future<IdentityPool> createIdentityPool({
required bool allowUnauthenticatedIdentities,
required String identityPoolName,
bool? allowClassicFlow,
List<CognitoIdentityProvider>? cognitoIdentityProviders,
String? developerProviderName,
Map<String, String>? identityPoolTags,
List<String>? openIdConnectProviderARNs,
List<String>? samlProviderARNs,
Map<String, String>? supportedLoginProviders,
}) async {
ArgumentError.checkNotNull(
allowUnauthenticatedIdentities, 'allowUnauthenticatedIdentities');
ArgumentError.checkNotNull(identityPoolName, 'identityPoolName');
_s.validateStringLength(
'identityPoolName',
identityPoolName,
1,
128,
isRequired: true,
);
_s.validateStringLength(
'developerProviderName',
developerProviderName,
1,
128,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityService.CreateIdentityPool'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AllowUnauthenticatedIdentities': allowUnauthenticatedIdentities,
'IdentityPoolName': identityPoolName,
if (allowClassicFlow != null) 'AllowClassicFlow': allowClassicFlow,
if (cognitoIdentityProviders != null)
'CognitoIdentityProviders': cognitoIdentityProviders,
if (developerProviderName != null)
'DeveloperProviderName': developerProviderName,
if (identityPoolTags != null) 'IdentityPoolTags': identityPoolTags,
if (openIdConnectProviderARNs != null)
'OpenIdConnectProviderARNs': openIdConnectProviderARNs,
if (samlProviderARNs != null) 'SamlProviderARNs': samlProviderARNs,
if (supportedLoginProviders != null)
'SupportedLoginProviders': supportedLoginProviders,
},
);
return IdentityPool.fromJson(jsonResponse.body);
}