Token Authentication
Token authentication can be set up using the introduction and some help from this post.
Add the TokenAuthMiddleware
-middleware to your routes to protect them. This middleware
is a wrapper for the
auth_token_required
-decorator:
from edmunds.auth.middleware.tokenauthmiddleware import TokenAuthMiddleware
from app.http.controllers.mycontroller import MyController
app.route('/loggedin', uses=(MyController, 'get_logged_in')) \
.middleware(TokenAuthMiddleware)
TL;DR
The following request will give you an authentication token:
- Post-request to
/login
- Data:
email
password
- Headers:
content-type
:application/json
Add the token to future requests using either:
- Request-data:
auth_token
- Header:
Authentication-Token