Skip to content

An example for RESTful authentication using nginx, uWSGI, Flask, MongoDB and JSON Web Token(JWT).

License

Notifications You must be signed in to change notification settings

oliverSI/flask-restful-authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flask-restful-authentication

An example for RESTful authentication using nginx, uWSGI, Flask, MongoDB and JSON Web Token(JWT).

Quick Start

  1. Clone the repository with the following command.
git clone https://github.com/oliverSI/flask-restful-authentication.git
  1. Set environment variable for the email configuration.
export EMAIL_SERVER=[EMAIL_SERVER]
export EMAIL_USERNAME=[EMAIL_USERNAME]
export EMAIL_PASSWORD=[EMAIL_PASSWORD]
  1. Run containers with the following command.
docker-compose up -d

Calling API

Register

curl -X POST -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "password"}' http://127.0.0.1/v1/register

Activation

curl -X PUT -H "Content-Type: application/json" -d '{"activation_code": "activation code you received"}’ http://127.0.0.1/v1/activate

Login

curl -X GET -H "Content-Type: application/json" -d '{"email": “[email protected]", "password": "password"}’ http://127.0.0.1/v1/login

Do something

curl -H "Authorization: Bearer [token you got]" -H "Content-Type: application/json" http://127.0.0.1/v1/todo

About

An example for RESTful authentication using nginx, uWSGI, Flask, MongoDB and JSON Web Token(JWT).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published