1. 모든 람다의 메서드 요청 설정에 권한부여 GitmagotchiAuthorizer해주기

Untitled

2. 통합요청 → 기본 설정, 매핑템플릿 (콘텐츠 유형, 템플릿 본문) 확인

Untitled

Untitled

{
	"context" : {
		"sub" : "$context.authorizer.claims.sub",
	   "username": "$context.authorizer.claims['cognito:username']"
	}
}

3. 람다 핸들러 안에서 event로 확인. (자바는 뚫는 중 ㅜㅜ)

ex) Node.js

Untitled

주의 ) username이 “github_12345678” 이런식으로 나오기 때문에

꼭 앞에 없애주고 userId로 사용하세욤 ~^0^~

identities.userId로 하려면 복잡해서 간단하게 이렇게 했음다

ex) Python

def lambda_handler(event, context):    
    userId = event.get('context').get('username').replace('github_', '')