- Authenticate users via AWS Cognito
package main
import (
"context"
auth "github.com/gofor-little/aws-auth"
)
func main() {
// Initialize the auth package.
if err := auth.Initialize(context.Background(), "AWS_PROFILE", "AWS_REGION", "USER_POOL_ID", "CLIENT_ID"); err != nil {
panic(err)
}
// Sign in.
if _, err := auth.SignIn(context.Background(), "john@example.com", "password1234"); err != nil {
panic(err)
}
}
Ensure the following environment variables are set, usually with a .env file.
AWS_PROFILE
(an AWS CLI profile name)AWS_REGION
(a valid AWS region)
Run go test ./...
at the root of the project.