@aws-sdk/client-cognito-identity-provider
Description
AWS SDK for JavaScript CognitoIdentityProvider Client for Node.js, Browser and React Native.
With the Amazon Cognito user pools API, you can configure user pools and authenticate users. To
authenticate users from third-party identity providers (IdPs) in this API, you can
link IdP users to native user profiles. Learn more
about the authentication and authorization of federated users at Adding user pool sign-in through a third party and in the User pool federation endpoints and managed login reference.
This API reference provides detailed information about API operations and object types
in Amazon Cognito.
Along with resource management operations, the Amazon Cognito user pools API includes classes
of operations and authorization models for client-side and server-side authentication of
users. You can interact with operations in the Amazon Cognito user pools API as any of the
following subjects.
-
An administrator who wants to configure user pools, app clients, users,
groups, or other user pool functions.
-
A server-side app, like a web application, that wants to use its Amazon Web Services
privileges to manage, authenticate, or authorize a user.
-
A client-side app, like a mobile app, that wants to make unauthenticated
requests to manage, authenticate, or authorize a user.
For more information, see Understanding API, OIDC, and managed login pages
authentication in the Amazon Cognito Developer Guide.
With your Amazon Web Services SDK, you can build the logic to support operational flows in every use
case for this API. You can also make direct REST API requests to Amazon Cognito user pools service endpoints. The following links can get you started
with the CognitoIdentityProvider
client in supported Amazon Web Services SDKs.
To get started with an Amazon Web Services SDK, see Tools to Build on Amazon Web Services. For example actions and scenarios, see Code examples for Amazon Cognito Identity Provider using Amazon Web Services
SDKs.
Installing
To install this package, simply type add or install @aws-sdk/client-cognito-identity-provider
using your favorite package manager:
npm install @aws-sdk/client-cognito-identity-provider
yarn add @aws-sdk/client-cognito-identity-provider
pnpm add @aws-sdk/client-cognito-identity-provider
Getting Started
Import
The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the CognitoIdentityProviderClient
and
the commands you need, for example ListDevicesCommand
:
const { CognitoIdentityProviderClient, ListDevicesCommand } = require("@aws-sdk/client-cognito-identity-provider");
import { CognitoIdentityProviderClient, ListDevicesCommand } from "@aws-sdk/client-cognito-identity-provider";
Usage
To send a request, you:
- Initiate client with configuration (e.g. credentials, region).
- Initiate command with input parameters.
- Call
send
operation on client with command object as input.
- If you are using a custom http handler, you may call
destroy()
to close open connections.
const client = new CognitoIdentityProviderClient({ region: "REGION" });
const params = {
};
const command = new ListDevicesCommand(params);
Async/await
We recommend using await
operator to wait for the promise returned by send operation as follows:
try {
const data = await client.send(command);
} catch (error) {
} finally {
}
Async-await is clean, concise, intuitive, easy to debug and has better error handling
as compared to using Promise chains or callbacks.
Promises
You can also use Promise chaining
to execute send operation.
client.send(command).then(
(data) => {
},
(error) => {
}
);
Promises can also be called using .catch()
and .finally()
as follows:
client
.send(command)
.then((data) => {
})
.catch((error) => {
})
.finally(() => {
});
Callbacks
We do not recommend using callbacks because of callback hell,
but they are supported by the send operation.
client.send(command, (err, data) => {
});
v2 compatible style
The client can also send requests using v2 compatible style.
However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post
on modular packages in AWS SDK for JavaScript
import * as AWS from "@aws-sdk/client-cognito-identity-provider";
const client = new AWS.CognitoIdentityProvider({ region: "REGION" });
try {
const data = await client.listDevices(params);
} catch (error) {
}
client
.listDevices(params)
.then((data) => {
})
.catch((error) => {
});
client.listDevices(params, (err, data) => {
});
Troubleshooting
When the service returns an exception, the error will include the exception information,
as well as response metadata (e.g. request id).
try {
const data = await client.send(command);
} catch (error) {
const { requestId, cfId, extendedRequestId } = error.$metadata;
console.log({ requestId, cfId, extendedRequestId });
}
Getting Help
Please use these community resources for getting help.
We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
To test your universal JavaScript code in Node.js, browser and react-native environments,
visit our code samples repo.
Contributing
This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-cognito-identity-provider
package is updated.
To contribute to client you can check our generate clients scripts.
License
This SDK is distributed under the
Apache License, Version 2.0,
see LICENSE for more information.
Client Commands (Operations List)
<summary>
AddCustomAttributes
</summary>
Command API Reference / Input / Output
<summary>
AdminAddUserToGroup
</summary>
Command API Reference / Input / Output
<summary>
AdminConfirmSignUp
</summary>
Command API Reference / Input / Output
<summary>
AdminCreateUser
</summary>
Command API Reference / Input / Output
<summary>
AdminDeleteUser
</summary>
Command API Reference / Input / Output
<summary>
AdminDeleteUserAttributes
</summary>
Command API Reference / Input / Output
<summary>
AdminDisableProviderForUser
</summary>
Command API Reference / Input / Output
<summary>
AdminDisableUser
</summary>
Command API Reference / Input / Output
<summary>
AdminEnableUser
</summary>
Command API Reference / Input / Output
<summary>
AdminForgetDevice
</summary>
Command API Reference / Input / Output
<summary>
AdminGetDevice
</summary>
Command API Reference / Input / Output
<summary>
AdminGetUser
</summary>
Command API Reference / Input / Output
<summary>
AdminInitiateAuth
</summary>
Command API Reference / Input / Output
<summary>
AdminLinkProviderForUser
</summary>
Command API Reference / Input / Output
<summary>
AdminListDevices
</summary>
Command API Reference / Input / Output
<summary>
AdminListGroupsForUser
</summary>
Command API Reference / Input / Output
<summary>
AdminListUserAuthEvents
</summary>
Command API Reference / Input / Output
<summary>
AdminRemoveUserFromGroup
</summary>
Command API Reference / Input / Output
<summary>
AdminResetUserPassword
</summary>
Command API Reference / Input / Output
<summary>
AdminRespondToAuthChallenge
</summary>
Command API Reference / Input / Output
<summary>
AdminSetUserMFAPreference
</summary>
Command API Reference / Input / Output
<summary>
AdminSetUserPassword
</summary>
Command API Reference / Input / Output
<summary>
AdminSetUserSettings
</summary>
Command API Reference / Input / Output
<summary>
AdminUpdateAuthEventFeedback
</summary>
Command API Reference / Input / Output
<summary>
AdminUpdateDeviceStatus
</summary>
Command API Reference / Input / Output
<summary>
AdminUpdateUserAttributes
</summary>
Command API Reference / Input / Output
<summary>
AdminUserGlobalSignOut
</summary>
Command API Reference / Input / Output
<summary>
AssociateSoftwareToken
</summary>
Command API Reference / Input / Output
<summary>
ChangePassword
</summary>
Command API Reference / Input / Output
<summary>
CompleteWebAuthnRegistration
</summary>
Command API Reference / Input / Output
<summary>
ConfirmDevice
</summary>
Command API Reference / Input / Output
<summary>
ConfirmForgotPassword
</summary>
Command API Reference / Input / Output
<summary>
ConfirmSignUp
</summary>
Command API Reference / Input / Output
<summary>
CreateGroup
</summary>
Command API Reference / Input / Output
<summary>
CreateIdentityProvider
</summary>
Command API Reference / Input / Output
<summary>
CreateManagedLoginBranding
</summary>
Command API Reference / Input / Output
<summary>
CreateResourceServer
</summary>
Command API Reference / Input / Output
<summary>
CreateUserImportJob
</summary>
Command API Reference / Input / Output
<summary>
CreateUserPool
</summary>
Command API Reference / Input / Output
<summary>
CreateUserPoolClient
</summary>
Command API Reference / Input / Output
<summary>
CreateUserPoolDomain
</summary>
Command API Reference / Input / Output
<summary>
DeleteGroup
</summary>
Command API Reference / Input / Output
<summary>
DeleteIdentityProvider
</summary>
Command API Reference / Input / Output
<summary>
DeleteManagedLoginBranding
</summary>
Command API Reference / Input / Output
<summary>
DeleteResourceServer
</summary>
Command API Reference / Input / Output
<summary>
DeleteUser
</summary>
Command API Reference / Input / Output
<summary>
DeleteUserAttributes
</summary>
Command API Reference / Input / Output
<summary>
DeleteUserPool
</summary>
Command API Reference / Input / Output
<summary>
DeleteUserPoolClient
</summary>
Command API Reference / Input / Output
<summary>
DeleteUserPoolDomain
</summary>
Command API Reference / Input / Output
<summary>
DeleteWebAuthnCredential
</summary>
Command API Reference / Input / Output
<summary>
DescribeIdentityProvider
</summary>
Command API Reference / Input / Output
<summary>
DescribeManagedLoginBranding
</summary>
Command API Reference / Input / Output
<summary>
DescribeManagedLoginBrandingByClient
</summary>
Command API Reference / Input / Output
<summary>
DescribeResourceServer
</summary>
Command API Reference / Input / Output
<summary>
DescribeRiskConfiguration
</summary>
Command API Reference / Input / Output
<summary>
DescribeUserImportJob
</summary>
Command API Reference / Input / Output
<summary>
DescribeUserPool
</summary>
Command API Reference / Input / Output
<summary>
DescribeUserPoolClient
</summary>
Command API Reference / Input / Output
<summary>
DescribeUserPoolDomain
</summary>
Command API Reference / Input / Output
<summary>
ForgetDevice
</summary>
Command API Reference / Input / Output
<summary>
ForgotPassword
</summary>
Command API Reference / Input / Output
<summary>
GetCSVHeader
</summary>
Command API Reference / Input / Output
<summary>
GetDevice
</summary>
Command API Reference / Input / Output
<summary>
GetGroup
</summary>
Command API Reference / Input / Output
<summary>
GetIdentityProviderByIdentifier
</summary>
Command API Reference / Input / Output
<summary>
GetLogDeliveryConfiguration
</summary>
Command API Reference / Input / Output
<summary>
GetSigningCertificate
</summary>
Command API Reference / Input / Output
<summary>
GetUICustomization
</summary>
Command API Reference / Input / Output
<summary>
GetUser
</summary>
Command API Reference / Input / Output
<summary>
GetUserAttributeVerificationCode
</summary>
Command API Reference / Input / Output
<summary>
GetUserAuthFactors
</summary>
Command API Reference / Input / Output
<summary>
GetUserPoolMfaConfig
</summary>
Command API Reference / Input / Output
<summary>
GlobalSignOut
</summary>
Command API Reference / Input / Output
<summary>
InitiateAuth
</summary>
Command API Reference / Input / Output
<summary>
ListDevices
</summary>
Command API Reference / Input / Output
<summary>
ListGroups
</summary>
Command API Reference / Input / Output
<summary>
ListIdentityProviders
</summary>
Command API Reference / Input / Output
<summary>
ListResourceServers
</summary>
Command API Reference / Input / Output
<summary>
ListTagsForResource
</summary>
Command API Reference / Input / Output
<summary>
ListUserImportJobs
</summary>
Command API Reference / Input / Output
<summary>
ListUserPoolClients
</summary>
Command API Reference / Input / Output
<summary>
ListUserPools
</summary>
Command API Reference / Input / Output
<summary>
ListUsers
</summary>
Command API Reference / Input / Output
<summary>
ListUsersInGroup
</summary>
Command API Reference / Input / Output
<summary>
ListWebAuthnCredentials
</summary>
Command API Reference / Input / Output
<summary>
ResendConfirmationCode
</summary>
Command API Reference / Input / Output
<summary>
RespondToAuthChallenge
</summary>
Command API Reference / Input / Output
<summary>
RevokeToken
</summary>
Command API Reference / Input / Output
<summary>
SetLogDeliveryConfiguration
</summary>
Command API Reference / Input / Output
<summary>
SetRiskConfiguration
</summary>
Command API Reference / Input / Output
<summary>
SetUICustomization
</summary>
Command API Reference / Input / Output
<summary>
SetUserMFAPreference
</summary>
Command API Reference / Input / Output
<summary>
SetUserPoolMfaConfig
</summary>
Command API Reference / Input / Output
<summary>
SetUserSettings
</summary>
Command API Reference / Input / Output
<summary>
SignUp
</summary>
Command API Reference / Input / Output
<summary>
StartUserImportJob
</summary>
Command API Reference / Input / Output
<summary>
StartWebAuthnRegistration
</summary>
Command API Reference / Input / Output
<summary>
StopUserImportJob
</summary>
Command API Reference / Input / Output
<summary>
TagResource
</summary>
Command API Reference / Input / Output
<summary>
UntagResource
</summary>
Command API Reference / Input / Output
<summary>
UpdateAuthEventFeedback
</summary>
Command API Reference / Input / Output
<summary>
UpdateDeviceStatus
</summary>
Command API Reference / Input / Output
<summary>
UpdateGroup
</summary>
Command API Reference / Input / Output
<summary>
UpdateIdentityProvider
</summary>
Command API Reference / Input / Output
<summary>
UpdateManagedLoginBranding
</summary>
Command API Reference / Input / Output
<summary>
UpdateResourceServer
</summary>
Command API Reference / Input / [Output](https://docs.aws.amazon.com/AWSJavaSc