The Spark CLI is used to perform some operations in AWS Cognito, such as password change, forgot password, performing first sign in, and registering a TOTP device. This CLI will compliment future CLIs such as Haze and Maroon which will utilize this CLI's data to perform their own operations. More information on those will be available when they are ready for release.
If you find the password policy to not work for your pool settings, I recommend forking this repository and updating the CheckIfValidPassword
function in cognito/configuration.go
to match your needs.
- Navigate to the releases page and download the binary for your operating system. If you do not see your operating system, please submit an issue with your OS and ARCH so that it can be added.
- Place the binary in a location in your PATH (e.g. /usr/local/bin/spark)
- Run
spark init
to initialize the CLI's settings. This will require input of the client ID, pool ID, and region.
If you have not signed into the Cognito pool, please navigate to the First Sign In
section.
Init is used to first set up the CLI or to update the client ID, pool ID, and/or region.
- Run
spark init
(orspark init --overwrite
if you need to update any of the client ID, pool ID and/or region) - Follow the promps as necessary (or utilize the flags that can be specified via the CLI)
Update is used to update the CLI to the latest version
- Run
spark update
First Sign In is used if you have been added or created in a Cognito pool but have not performed a first sign in to verify your email and change your password.
- Run
spark first-sign-in
- Follow the prompts as necessary
Auth performs an auth to your Cognito pool and stores the token information for use with other tools that call Cognito-backed endpoints
- Run
spark auth
. If you want to force a refresh of your tokens, also add--force
- Follow the prompts to authenticate to the pool
Change Password will allow you to change your password. This operation uses the Cognito default password requirements.
- Run
spark change-password
- Follow the prompts to change your password
Register TOTP will register a TOTP device to you. This does not currently support SMS, but may in the future.
- Run
spark register-totp
- Follow the prompts to register a TOTP device
Reset Password is for if you do not know your current password but have previously performed an initial sign in.
- Run
spark reset-password
- Follow the prompts to reset your password
Refresh Tokens is for refreshing your access and ID tokens without re-authenticating. This assumes the Cognito default of 30 day expiry for the client.
- Run
spark refresh