Skip to content

Instantly share code, notes, and snippets.

@geoseong
Last active March 15, 2020 15:19
Show Gist options
  • Save geoseong/594789954a71b58ddf490c6e59bbaca7 to your computer and use it in GitHub Desktop.
Save geoseong/594789954a71b58ddf490c6e59bbaca7 to your computer and use it in GitHub Desktop.
The way to signup with KAKAO social provider using Amazon Cognito and AWS Amplify: step 05(Post Confirmation Cognito Lambda Trigger)
// amplify/backend/function/{amplify's auth Resource name}PostConfirmation/src/add-to-group.js
/* eslint-disable-line */ const aws = require('aws-sdk');
exports.handler = async (event, context, callback) => {
const cognitoidentityserviceprovider = new aws.CognitoIdentityServiceProvider({ apiVersion: '2016-04-18' });
const GroupName = event.request.clientMetadata.GroupName;
const addUserParams = {
GroupName,
UserPoolId: event.userPoolId,
Username: event.userName,
};
try {
await cognitoidentityserviceprovider.adminAddUserToGroup(addUserParams).promise();
callback(null, event);
} catch (e) {
callback(e);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment