Skip to content

Commit

Permalink
[fix] README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
parpa committed May 18, 2021
1 parent a6df4ae commit e2f5c1e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This example code demonstrates how to use AWS Cognito with AWS Go SDK in a form
3. Verify user's phone
4. Login with username or refresh token

In order this solution to work, you need to have AWS credentials configured (file `.aws/configuration` exists) and User Pool created in AWS Console. You have to disable "Remember device" and enable "Sms second-factor" on authentication tab.
In order this solution to work, you need create User Pool in AWS Console. You have to disable "Remember device" and enable "Sms second-factor" on authentication tab.

When the app client is created, in it's settings select "Enable username-password (non-SRP) flow for app-based authentication (USER_PASSWORD_AUTH)".

Expand All @@ -31,13 +31,24 @@ go build -o ./build/cognito
Without client secret:

```go
AWS_PROFILE=XXX COGNITO_APP_CLIENT_ID=XXX COGNITO_USER_POOL_ID=XXX PORT=8080 ./build/cognito
AWS_REGION=XXX COGNITO_APP_CLIENT_ID=XXX COGNITO_USER_POOL_ID=XXX PORT=8080 ./build/cognito
```

With client secret:

```go
AWS_PROFILE=XXX COGNITO_APP_CLIENT_ID=XXX COGNITO_APP_CLIENT_SECRET=XXX COGNITO_USER_POOL_ID=XXX PORT=8080 ./build/cognito
AWS_REGION=XXX COGNITO_APP_CLIENT_ID=XXX COGNITO_APP_CLIENT_SECRET=XXX COGNITO_USER_POOL_ID=XXX PORT=8080 ./build/cognito
```

## Quick setup (bash)

```sh
export AWS_REGION=xxxx
export COGNITO_APP_CLIENT_ID=xxxxx
export COGNITO_APP_CLIENT_SECRET=xxxxx
export COGNITO_USER_POOL_ID=xxxxx
export PORT=8080
go run main.go
```

It's worth noting that in production environment you should not pass client secrets this way because with adequate permissions it's possible to read environmental variables of a running process. Also if you call a command that way, secret hash will be stored in your shell history. You should keep those issues in mind and mitigate them in your enviroment.
Expand Down

0 comments on commit e2f5c1e

Please sign in to comment.