Skip to content

Instantly share code, notes, and snippets.

@hatertron3000
Created September 21, 2019 17:02
Show Gist options
  • Save hatertron3000/0594c737d3a45470c2f0b86b9e5d1411 to your computer and use it in GitHub Desktop.
Save hatertron3000/0594c737d3a45470c2f0b86b9e5d1411 to your computer and use it in GitHub Desktop.
Example Define Auth Challenge Lambda implementing that designates the first and only auth challenge as a CUSTOM_CHALLENGE
exports.handler = (event, context, callback) => {
if (event.request.session.length == 0) {
event.response.issueTokens = false
event.response.failAuthentication = false
event.response.challengeName = 'CUSTOM_CHALLENGE'
} else if (event.request.session.length == 1 && event.request.session[0].challengeName == 'CUSTOM_CHALLENGE' && event.request.session[0].challengeResult == true) {
event.response.issueTokens = true
event.response.failAuthentication = false
} else {
event.response.issueTokens = false
event.response.failAuthentication = true
}
callback(null, event)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment