This project contains two branches:
- simple_auth: Contains simple auth framework for username and password based login using flask-restfull and arangodb as the backend.
- master; This contains token based auth using flask-restful and arangodb as the backend.
###Setup Steps
- Make a database of your in arangodb and put it in settings.py as:
ARANGODB_DATABASE="mydatabase"
- Run the migration for making users collection:
$> python migrate_collections.py
- Run server to test it.
$> python url.py
- Open a new terminal.
- Create a user.
$> curl -i -X POST -H "Content-Type: application/json" -d '{"username":"user","password":"pass"}' http://127.0.0.1:5000/api/users
- Try to get access token for that user.
$> curl -u user:pass -i -X GET http://127.0.0.1:5000/api/token
- Now you will get an auth token. You can use that auth token to access other resources like:
$> curl -u your-auth-token:unused -i -X GET http://127.0.0.1:5000/
- You should get hello world in response.