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.
To install this package, use the CLI of 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
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";
To send a request:
- Instantiate a client with configuration (e.g. credentials, region).
- Instantiate a command with input parameters.
- Call the
send operation on the client, providing the command object as input.
const client = new CognitoIdentityProviderClient({ region: "REGION" });
const params = { };
const command = new ListDevicesCommand(params);
We recommend using the await
operator to wait for the promise returned by send operation as follows:
try {
const data = await client.send(command);
} catch (error) {
} finally {
}
You can also use Promise chaining.
client
.send(command)
.then((data) => {
})
.catch((error) => {
})
.finally(() => {
});
The aggregated client class is exported from the same package, but without the "Client" suffix.
CognitoIdentityProvider extends CognitoIdentityProviderClient and additionally supports all operations, waiters, and paginators as methods.
This style may be familiar to you from the AWS SDK for JavaScript v2.
If you are bundling the AWS SDK, we recommend using only the bare-bones client (CognitoIdentityProviderClient).
More details are in the blog post on
modular packages in AWS SDK for JavaScript.
import { CognitoIdentityProvider } from "@aws-sdk/client-cognito-identity-provider";
const client = new CognitoIdentityProvider({ region: "REGION" });
try {
const data = await client.listDevices(params);
} catch (error) {
}
client
.listDevices(params)
.then((data) => {
})
.catch((error) => {
});
client.listDevices(params, (err, data) => {
});
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 });
}
See also docs/ERROR_HANDLING.
Please use these community resources for getting help.
We use 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.
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.
This SDK is distributed under the
Apache License, Version 2.0,
see LICENSE for more information.
AddCustomAttributes
Command API Reference / Input / Output
AddUserPoolClientSecret
Command API Reference / Input / Output
AdminAddUserToGroup
Command API Reference / Input / Output
AdminConfirmSignUp
Command API Reference / Input / Output
AdminCreateUser
Command API Reference / Input / Output
AdminDeleteUser
Command API Reference / Input / Output
AdminDeleteUserAttributes
Command API Reference / Input / Output
AdminDisableProviderForUser
Command API Reference / Input / Output
AdminDisableUser
Command API Reference / Input / Output
AdminEnableUser
Command API Reference / Input / Output
AdminForgetDevice
Command API Reference / Input / Output
AdminGetDevice
Command API Reference / Input / Output
AdminGetUser
Command API Reference / Input / Output
AdminInitiateAuth
Command API Reference / Input / Output
AdminLinkProviderForUser
Command API Reference / Input / Output
AdminListDevices
Command API Reference / Input / Output
AdminListGroupsForUser
Command API Reference / Input / Output
AdminListUserAuthEvents
Command API Reference / Input / Output
AdminRemoveUserFromGroup
Command API Reference / Input / Output
AdminResetUserPassword
Command API Reference / Input / Output
AdminRespondToAuthChallenge
Command API Reference / Input / Output
AdminSetUserMFAPreference
Command API Reference / Input / Output
AdminSetUserPassword
Command API Reference / Input / Output
AdminSetUserSettings
Command API Reference / Input / Output
AdminUpdateAuthEventFeedback
Command API Reference / Input / Output
AdminUpdateDeviceStatus
Command API Reference / Input / Output
AdminUpdateUserAttributes
Command API Reference / Input / Output
AdminUserGlobalSignOut
Command API Reference / Input / Output
AssociateSoftwareToken
Command API Reference / Input / Output
ChangePassword
Command API Reference / Input / Output
CompleteWebAuthnRegistration
Command API Reference / Input / Output
ConfirmDevice
Command API Reference / Input / Output
ConfirmForgotPassword
Command API Reference / Input / Output
ConfirmSignUp
Command API Reference / Input / Output
CreateGroup
Command API Reference / Input / Output
CreateIdentityProvider
Command API Reference / Input / Output
CreateManagedLoginBranding
Command API Reference / Input / Output
CreateResourceServer
Command API Reference / Input / Output
CreateTerms
Command API Reference / Input / Output
CreateUserImportJob
Command API Reference / Input / Output
CreateUserPool
Command API Reference / Input / Output
CreateUserPoolClient
Command API Reference / Input / Output
CreateUserPoolDomain
Command API Reference / Input / Output
CreateUserPoolReplica
Command API Reference / Input / Output
DeleteGroup
Command API Reference / Input / Output
DeleteIdentityProvider
Command API Reference / Input / Output
DeleteManagedLoginBranding
Command API Reference / Input / Output
DeleteResourceServer
Command API Reference / Input / Output
DeleteTerms
Command API Reference / Input / Output
DeleteUser
Command API Reference / Input / Output
DeleteUserAttributes
Command API Reference / Input / Output
DeleteUserPool
Command API Reference / Input / Output
DeleteUserPoolClient
Command API Reference / Input / Output
DeleteUserPoolClientSecret
Command API Reference / Input / Output
DeleteUserPoolDomain
Command API Reference / Input / Output
DeleteUserPoolReplica
Command API Reference / Input / Output
DeleteWebAuthnCredential
Command API Reference / Input / Output
DescribeIdentityProvider
Command API Reference / Input / Output
DescribeManagedLoginBranding
Command API Reference / Input / Output
DescribeManagedLoginBrandingByClient
Command API Reference / Input / Output
DescribeResourceServer
Command API Reference / Input / Output
DescribeRiskConfiguration
Command API Reference / Input / Output
DescribeTerms
Command API Reference / Input / Output
DescribeUserImportJob
Command API Reference / Input / Output
DescribeUserPool
Command API Reference / Input / Output
DescribeUserPoolClient
Command API Reference / Input / Output
DescribeUserPoolDomain
Command API Reference / Input / Output
ForgetDevice
Command API Reference / Input / Output
ForgotPassword
Command API Reference / Input / Output
GetCSVHeader
Command API Reference / Input / Output
GetDevice
Command API Reference / Input / Output
GetGroup
Command API Reference / Input / Output
GetIdentityProviderByIdentifier
Command API Reference / Input / Output
GetLogDeliveryConfiguration
Command API Reference / Input / Output
GetProvisionedLimit
Command API Reference / Input / Output
GetSigningCertificate
Command API Reference / Input / Output
GetTokensFromRefreshToken
Command API Reference / Input / Output
GetUICustomization
Command API Reference / Input / Output
GetUser
Command API Reference / Input / Output
GetUserAttributeVerificationCode
Command API Reference / Input / Output
GetUserAuthFactors
Command API Reference / Input / Output
GetUserPoolMfaConfig
Command API Reference / Input / Output
GlobalSignOut
Command API Reference / Input / Output
InitiateAuth
Command API Reference / Input / Output
ListDevices
Command API Reference / Input / Output
ListGroups
Command API Reference / Input / Output
ListIdentityProviders
Command API Reference / Input / Output
ListResourceServers
Command API Reference / Input / Output
ListTagsForResource
Command API Reference / Input / Output
ListTerms
Command API Reference / Input / Output
ListUserImportJobs
Command API Reference / Input / Output
ListUserPoolClients
Command API Reference / Input / Output
ListUserPoolClientSecrets
Command API Reference / Input / Output
ListUserPoolReplicas
Command API Reference / Input / Output
ListUserPools
Command API Reference / Input / Output
ListUsers
Command API Reference / Input / Output
ListUsersInGroup
Command API Reference / Input / Output
ListWebAuthnCredentials
Command API Reference / Input / Output
ResendConfirmationCode
Command API Reference / Input / Output
RespondToAuthChallenge
Command API Reference / Input / Output
RevokeToken
Command API Reference / Input / Output
SetLogDeliveryConfiguration
Command API Reference / Input / Output
SetRiskConfiguration
Command API Reference / Input / Output
SetUICustomization
Command API Reference / Input / Output
SetUserMFAPreference
Command API Reference / Input / Output
SetUserPoolMfaConfig
Command API Reference / Input / Output
SetUserSettings
Command API Reference / Input / Output
SignUp
Command API Reference / Input / Output
StartUserImportJob
Command API Reference / Input / Output
StartWebAuthnRegistration
Command API Reference / Input / Output
StopUserImportJob
Command API Reference / Input / Output
TagResource
Command API Reference / Input / Output
UntagResource
Command API Reference / Input / Output
UpdateAuthEventFeedback
Command API Reference / Input / Output
UpdateDeviceStatus
Command API Reference / Input / Output
UpdateGroup
Command API Reference / Input / Output
UpdateIdentityProvider
Command API Reference / Input / Output
UpdateManagedLoginBranding
Command API Reference / Input / Output
UpdateProvisionedLimit
Command API Reference / Input / Output
UpdateResourceServer
Command API Reference / Input / Output
UpdateTerms
Command API Reference / Input / Output
UpdateUserAttributes
Command API Reference / Input / Output
UpdateUserPool
Command API Reference / Input / Output
UpdateUserPoolClient
Command API Reference / Input / Output
UpdateUserPoolDomain
Command API Reference / Input / Output
UpdateUserPoolReplica
Command API Reference / Input / Output
VerifySoftwareToken
Command API Reference / Input / Output
VerifyUserAttribute
Command API Reference / Input / Output