https://github.com/yeslayla/cognito-oauthtools
Simple AWS Cognito client to simplify implementing oauth into python applications
https://github.com/yeslayla/cognito-oauthtools
aws cognito oauth python-library
Last synced: about 1 month ago
JSON representation
Simple AWS Cognito client to simplify implementing oauth into python applications
- Host: GitHub
- URL: https://github.com/yeslayla/cognito-oauthtools
- Owner: yeslayla
- License: gpl-3.0
- Created: 2020-01-25T05:07:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-01T00:59:24.000Z (over 5 years ago)
- Last Synced: 2025-01-14T14:07:54.292Z (4 months ago)
- Topics: aws, cognito, oauth, python-library
- Language: Python
- Homepage: https://pypi.org/project/cognito-oauthtools/
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
  
# cognito-oauthtools
Simple AWS Cognito client to simplify project implementation.
## Getting Started
### Installation
cognito-oauthtools can easily be install using pip:
```bash
pip install cognito-oauthtools
```## Objects
### Client
`cognito_oauthtools.Client`
#### Intializing
To intialize a `cognito_oauthtools.Client`, you must pass it:
- `endpoint`
The dns name of the Cognito endpoint
- `client_id`
The id of your Cognito authorizer clinet
- `client_secret`
The secret for your Cognito client
- `host_domain`
The domain name of the server that cognito will hit with oauth redirects
- `logout_path` = `"/"`
Path on the host to return to after logging out
- `redirect_path` = `"/oauth"`
Path on the host to return to after logging in
```python
oauth = cognito_oauthtools.Client('ENDPOINT.amazoncognito.com', 'CLIENT_ID', 'CLIENT_SECRET', 'myapp.example')
```#### Properties
- `loginUrl`
Cognito URL to authorize
- `registerUrl`
Cognito URL to register a new user
- `logoutUrl`
Cognito URL to logout
#### Methods
- `get_token(code)`
Method that gets cognito token from the oauth return code
### User
`cognito_oauthtools.User`
#### Intializing
To intialize a `cognito_oauthtools.User`, you must pass it:
- `client`
`cognito_oauthtools.Client` object for the user to use
- `token`
The user's authorization token
```python
user = cognito_oauthtools.User(client, "xxxxTOKENxxxx")
```