项目作者: richmondu

项目描述 :
libpycognito demonstrates using Amazon Cognito for secure user signup and login with MFA/2FA/OTP via email or SMS
高级语言: Python
项目地址: git://github.com/richmondu/libpycognito.git
创建时间: 2019-07-04T09:35:46Z
项目社区:https://github.com/richmondu/libpycognito

开源协议:

下载


libpycognito

libpycognito demonstrates Amazon Cognito using AWS SDK Python boto3 library.

Amazon Cognito lets you add user sign-up, sign-in, and access control to your web and mobile apps quickly and easily.
Amazon Cognito scales to millions of users and supports sign-in with social identity providers,
such as Facebook, Google, and Amazon, and enterprise identity providers via SAML 2.0.

The sample application is just a console application. Need to integrate to Flask or Django to make it a browser application.

Features:

  1. user
  2. 1. signup (will receive email containing confirmation code)
  3. 2. confirm signup (use confirmation code)
  4. 3. forgot password (will receive email containing confirmation code)
  5. 4. config forgot password (use confirmation code)
  6. 5. login (will return access token)
  7. 6. get user profile (use access token)
  8. 7. update profile (use access token)
  9. 8. change password (use access token)
  10. 9. verify access token which is to be passed for succeeding api calls
  11. 10. logout
  12. admin
  13. 1. list users
  14. 2. disable user
  15. 3. enable user
  16. 4. list groups for user
  17. 5. add user to group (users who upgraded from free-tier can be transferred to subscription-tier group)
  18. 6. remove user from group
  19. 7. logout a user
  20. 8. delete user

Instructions:

  1. 1. Setup Amazon Cognito account
  2. A. Click on "Manage User Pools"
  3. B. Click on "Create a user pool"
  4. C. Type Pool name and click "Step through settings"
  5. D. Check "family name" and "given name" and click "Next step"
  6. E. Click "Next step"
  7. F. Click "Next step"
  8. G. Click "Next step"
  9. H. Click "Next step"
  10. I. Click "Next step"
  11. J. Click "Add an app client", type App client name, uncheck "Generate client secret",
  12. click "Create app client" and click "Next step"
  13. K. Click "Next step"
  14. L. Click "Create pool"
  15. 2. Update cognito_config.py
  16. A. CONFIG_USER_POOL_REGION = Region of Cognito User Pool ex. "ap-southeast-1"
  17. B. CONFIG_USER_POOL_ID = Copy from General settings/Pool Id
  18. C. CONFIG_CLIENT_ID = Copy from General settings/App clients/App client id
  19. 3. Install Python libraries
  20. pip install -r requirements.txt

References:

https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cognito-idp.html
https://github.com/capless/warrant