Skip to content

Instantly share code, notes, and snippets.

@yasudacloud
Created December 11, 2022 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasudacloud/d96cfc14936db89924b2ecc2b25d0df3 to your computer and use it in GitHub Desktop.
Save yasudacloud/d96cfc14936db89924b2ecc2b25d0df3 to your computer and use it in GitHub Desktop.
controllers/cognito-controller.js
'use strict';
const {
CognitoIdentityProviderClient,
ListUsersCommand
} = require("@aws-sdk/client-cognito-identity-provider");
module.exports = ({strapi}) => ({
async index(ctx) {
const {userPoolId, region} = strapi.config.get('plugin.strapi-plugin-user-pools')
const client = new CognitoIdentityProviderClient({region});
const command = new ListUsersCommand({
UserPoolId: userPoolId
});
const {Users, PaginationToken} = await client.send(command);
ctx.body = {Users, PaginationToken}
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment