UserPoolAdmin
Source:
src/AWS/Cognito/UserPoolAdmin.ts
Runtime binding for administrative Cognito user pool operations.
Bind this to a UserPool inside a function runtime to get a typed client
for user management and admin auth flows. The binding grants the
corresponding cognito-idp:* IAM actions scoped to the pool’s ARN and
injects the pool ID into every call.
Managing Users
Section titled “Managing Users”Create a User with a Permanent Password
const admin = yield* Cognito.UserPoolAdmin(pool);
yield* admin.adminCreateUser({ Username: "user@example.com", MessageAction: "SUPPRESS", UserAttributes: [ { Name: "email", Value: "user@example.com" }, { Name: "email_verified", Value: "true" }, ],});yield* admin.adminSetUserPassword({ Username: "user@example.com", Password: "Sup3r-secret!", Permanent: true,});Look Up and Delete a User
const user = yield* admin.adminGetUser({ Username: "user@example.com" });yield* admin.adminDeleteUser({ Username: "user@example.com" });Groups
Section titled “Groups”yield* admin.adminAddUserToGroup({ Username: "user@example.com", GroupName: "Admins",});const admins = yield* admin.listUsersInGroup({ GroupName: "Admins" });const groups = yield* admin.adminListGroupsForUser({ Username: "user@example.com",});Federation and Devices
Section titled “Federation and Devices”Link a Federated Identity to a Native User
yield* admin.adminLinkProviderForUser({ DestinationUser: { ProviderName: "Cognito", ProviderAttributeValue: "user@example.com", }, SourceUser: { ProviderName: "Google", ProviderAttributeName: "Cognito_Subject", ProviderAttributeValue: googleSub, },});List a User’s Remembered Devices
const devices = yield* admin.adminListDevices({ Username: "user@example.com",});