0.3.2 • Published 2 years ago
ts-cognito
Reference
Usage
User Client
import { CognitoClient } from "ts-cognito";
const client = new CognitoClient(COGNITO_CLIENT_ID);
const response = await client.initiateAuth("dummy", "dummy");
| method | input | output |
|---|
| signUp | username: string,password: string,attributes?: AttributeType[] | Promise\<SignUpCommandOutput> |
| confirmSignUp | username: string,confirmationCode: string | Promise\<ConfirmSignUpCommandOutput> |
| resendConfirmationCode | username: string | Promise\<ResendConfirmationCodeCommandOutput> |
| initiateAuth | username: string,password: string | Promise\<InitiateAuthCommandOutput> |
| refreshTokenAuth | refreshToken: string | Promise\<InitiateAuthCommandOutput> |
| getAuthenticationTokens | response: InitiateAuthCommandOutput | AuthOutput |
| globalSignOut | accessToken: string | Promise\<GlobalSignOutCommandOutput> |
| getUser | accessToken: string | Promise\<GetUserCommandOutput> |
| updateUserAttributes | accessToken: string,attributes: AttributeType[] | Promise\<UpdateUserAttributesCommandOutput> |
| respondToAuthChallenge | session: string,username: string,password: string | Promise\<RespondToAuthChallengeCommandOutput> |
| changePassword | accessToken: string,previousPassword: string,proposedPassword: string | Promise\<ChangePasswordCommandOutput> |
| forgotPassword | username: string | Promise\<ForgotPasswordCommandOutput> |
| confirmForgotPassword | confirmationCode: string,username: string,password: string | Promise\<ConfirmForgotPasswordCommandOutput> |
| deleteUser | accessToken: string | Promise\<DeleteGroupCommandOutput> |
Admin Client
import { CognitoAdminClient } from "ts-cognito";
const admin = new CognitoAdminClient(COGNITO_USER_POOL_ID);
const response = await admin.isExistUser("dummy");
| method | input | output |
|---|
| isExistUser | username: string | Promise\<boolean> |
| listUsers | limit: number,paginationToken?: string | Promise\<ListUsersCommandOutput> |
| getUser | userName: string | Promise\<AdminGetUserCommandOutput> |
| disableUser | userName: string | Promise\<AdminDisableUserCommandOutput> |
| enableUser | userName: string | Promise\<AdminEnableUserCommandOutput> |
| setAttribute | userName: string,name: string,value: string | Promise\<AdminUpdateUserAttributesCommandOutput> |
| deleteUser | username: string | Promise\<AdminDeleteUserCommandOutput> |