unlinkIdentity method
Unlinks a federated identity from an existing account. Unlinked logins will be considered new identities next time they are seen. Removing the last linked login will make this identity inaccessible.
This is a public API. You do not need any credentials to call this API.
May throw InvalidParameterException. May throw ResourceNotFoundException. May throw NotAuthorizedException. May throw ResourceConflictException. May throw TooManyRequestsException. May throw InternalErrorException. May throw ExternalServiceException.
Parameter identityId
:
A unique identifier in the format REGION:GUID.
Parameter logins
:
A set of optional name-value pairs that map provider names to provider
tokens.
Parameter loginsToRemove
:
Provider names to unlink from this identity.
Implementation
Future<void> unlinkIdentity({
required String identityId,
required Map<String, String> logins,
required List<String> loginsToRemove,
}) async {
ArgumentError.checkNotNull(identityId, 'identityId');
_s.validateStringLength(
'identityId',
identityId,
1,
55,
isRequired: true,
);
ArgumentError.checkNotNull(logins, 'logins');
ArgumentError.checkNotNull(loginsToRemove, 'loginsToRemove');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityService.UnlinkIdentity'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
signed: false,
// TODO queryParams
headers: headers,
payload: {
'IdentityId': identityId,
'Logins': logins,
'LoginsToRemove': loginsToRemove,
},
);
}