Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md: document AWSSRP.set_new_password_challenge() #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Makes working with AWS Cognito easier for Python developers.
- [Logout](#logout)
- [Cognito SRP Utility](#cognito-srp-utility) `warrant.aws_srp.AWSSRP`
- [Using AWSSRP](#using-awssrp)
- [Setting new password with AWSSRP](#setting-new-password-with-awssrp)
- [Projects Using Warrant](#projects-using-warrant)
- [Django Warrant](#django-warrant)
- [Authors](#authors)
Expand Down Expand Up @@ -460,6 +461,30 @@ aws = AWSSRP(username='username', password='password', pool_id='user_pool_id',
tokens = aws.authenticate_user()
```

### Setting new password with AWSSRP

If you try to change the password with the `Cognito.change_password()` you
might come across following error:

```
File ".../warrant/__init__.py", line 196, in check_token
raise AttributeError('Access Token Required to Check Token')
AttributeError: Access Token Required to Check Token
```

which was asked for in a number of issues. The correct approach is to use
`AWSSRP.set_new_password_challenge()` as shown below:

```python
import boto3
from warrant.aws_srp import AWSSRP

client = boto3.client('cognito-idp', region_name='region')
aws = AWSSRP(username='username', password='password', pool_id='user_pool_id',
client_id='client_id', client=client)
tokens = aws.set_new_password_challenge('new_password')
```

## Projects Using Warrant

#### [Django Warrant](https://www.github.com/metametricsinc/django-warrant)
Expand Down