Is it possible to support JWT and basic auth on the same API function? It
seems like JWT token verification is taking preference and returns even
though AuthJWT documentation says token is optional. Some sample code below:
*Controller jwt.py:*
myjwt = AuthJWT(auth, secret_key = "sometestkey12345")
@auth.requires_login()
@request.restful()
def get():
response.view = 'generic.json'
def POST(*args, **vars):
token = myjwt.jwt_token_manager()
return token
return locals()
@myjwt.allows_jwt()
@auth.requires_login()
@request.restful()
def test():
def GET(*args, **vars):
return "OK"
return locals()
*Output:*
curl -X POST -u <user>:<pass> https://localhost/testapp/jwt/get
*Result* - Successfully returns JWT token
curl -X GET -H "Authorization: Bearer <token>"
https://localhost/testapp/jwt/test
*Result* - Successfully returns OK
curl -X GET -u <user>:<pass> https://localhost/testapp/jwt/test
*Result* - Invalid JWT header
*Expected* - OK
Any help is appreciated!
Akash
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.