Update Workflow Update Workflow Update Workflow Update Workflow Update Workflow
cognito-oauthtools
Simple AWS Cognito client to simplify project implementation.
Getting Started
Installation
cognito-oauthtools can easily be install using pip:
pip install cognito-oauthtools
Objects
Client
cognito_oauthtools.Client
Intializing
To intialize a cognito_oauthtools.Client, you must pass it:
-
endpointThe dns name of the Cognito endpoint
-
client_idThe id of your Cognito authorizer clinet
-
client_secretThe secret for your Cognito client
-
host_domainThe 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
oauth = cognito_oauthtools.Client('ENDPOINT.amazoncognito.com', 'CLIENT_ID', 'CLIENT_SECRET', 'myapp.example')
Properties
-
loginUrlCognito URL to authorize
-
registerUrlCognito URL to register a new user
-
logoutUrlCognito 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:
-
clientcognito_oauthtools.Clientobject for the user to use -
tokenThe user's authorization token
user = cognito_oauthtools.User(client, "xxxxTOKENxxxx")