DEV Community

Discussion on: Passwordless Authentication with Cognito

Collapse
 
jrothman profile image
Joel Rothman

Hi Duarte - thanks for the post. I'm a bit of a Go and Cognito noob, so apologies if this is a dumb question. When I try setup my lambda functions there are a number of dependencies that they need that I cannot figure out, for example: auth.Challenge and request.Session. Could you provide some assistance in terms of the packages (and anything else you think I should know) in order to configure and run your example?

Collapse
 
duarten profile image
Duarte Nunes

Hi Joel, apologies for not preparing a runnable example. auth.Challenge is my own type, defined as

type AttributeType string

const (
    Email       AttributeType = "email"
    Phone       AttributeType = "phone_number"
    NoAttribute string        = ""
)

type Challenge struct {
    Attr AttributeType
    Code string
}

request.Session is a member of CognitoEventUserPoolsCreateAuthChallengeRequest, the type of the Request field in CognitoEventUserPoolsCreateAuthChallenge. The latter is the input type of the Lambda function for the create auth challenge trigger.

Hope that helps.

Collapse
 
jrothman profile image
Joel Rothman

Thanks Duarte - much appreciated!