npm.io
3.1079.0 • Published yesterday

@aws-sdk/client-cognito-identity-provider

Licence
Apache-2.0
Version
3.1079.0
Deps
8
Size
2.7 MB
Vulns
0
Weekly
0
Stars
3.6K

@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.

  1. An administrator who wants to configure user pools, app clients, users, groups, or other user pool functions.

  2. A server-side app, like a web application, that wants to use its Amazon Web Services privileges to manage, authenticate, or authorize a user.

  3. 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, 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

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:

// ES5 example
const { CognitoIdentityProviderClient, ListDevicesCommand } = require("@aws-sdk/client-cognito-identity-provider");
// ES6+ example
import { CognitoIdentityProviderClient, ListDevicesCommand } from "@aws-sdk/client-cognito-identity-provider";
Usage

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 = { /** input parameters */ };
const command = new ListDevicesCommand(params);
Async/await

We recommend using the await operator to wait for the promise returned by send operation as follows:

// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}
Promises

You can also use Promise chaining.

client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });
Aggregated client

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" });

// async/await.
try {
  const data = await client.listDevices(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listDevices(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks (not recommended).
client.listDevices(params, (err, data) => {
  // process err and 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);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

See also docs/ERROR_HANDLING.

Getting Help

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.

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)

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