NOTE: If you're looking for a solution using OIDC, please visit oidc branch on this repository.
This repository is an example code for creating Amazon Cognito user via Kakaotalk signin
Deploying this cdk will provision below resources on you AWS Account.
- awscli
- Nodejs 16+
- AWS Account and Locally configured AWS credential
this repository consists of 2 parts
- infra - provision AWS resources such as Cognito UserPool, ApiGateway, etc.
- web - run Nextjs web service on locally to test Kakao signin
- Install project dependencies
$ cd infra
$ npm i
- Install cdk in global context and run
cdk bootstrap
if you did not initailize cdk yet.
$ npm i -g [email protected]
$ cdk bootstrap
-
open /infra/config/dev.toml and replace values for your environment
-
copy
dev.toml
file under infra folder with name.toml
$ cp config/dev.toml .toml
- Deploy CDK Stacks on AWS
$ cdk deploy "*" --require-approval never
- visit Kakao Developer Console and create your app
Cognito requires user email to register user, so you should add email to scope on Kakao Login
- register web platform url with
http://localhost:3000
- enable
Kakao Login
and set redirect uri withhttp://localhost:3000
-
copy
Javascript Key
andREST API Key
on your app summary page -
open /web/lib/interfaces/config.ts and edit below variables:
- AmplifyConfig.UserPoolId - check out your AWS console or output of
cdk deploy
at infra - AmplifyConfig.UserPoolWebClientId - check out your AWS console or output of
cdk deploy
at infra - ApiHash - check out your AWS console or output of
cdk deploy
at infra - IdentityProvider.Kakao.AppKey - paste
Javascript Key
at Kakao Developer Console - IdentityProvider.Kakao.ApiKey - paste
REST API Key
at Kakao Developer Console
- Install dependencies
$ cd web
$ npm i
- run dev server
$ cd web
$ npm run dev
-
visit http://localhost:3000 and click kakao login button
-
login at redirected kakako page
-
alert should be displayed (open browser console to find the access token received from Kakaotalk)
-
visit Amazon Cognito UserPool console page
-
user and group should be created
destroy provisioned cloud resources
$ cd infra
$ cdk destroy "*"