[web2py] Re: Implementing Token Based authentication JWT

2017-08-23 Thread Carlos A. Armenta Castro
My 1 cent. How to use AuthJWT with requests python library (client): import requests credentials = {'username': 'chuma@xxx.com', 'password': 'mypasswordhere'} r = requests.post('http://127.0.0.1:8000/myapp/default/login_and_take_token', data=credentials) if r.status_code == 200: #Get

[web2py] Re: Implementing Token Based authentication JWT

2017-08-23 Thread Carlos A. Armenta Castro
Very nice!!! A question: in how much time expires the token? how to know it? El sábado, 19 de agosto de 2017, 15:31:10 (UTC-7), Oasis Agano escribió: > > CONTROLLER > > > from gluon.tools import AuthJWT > import requests > > def index(): > > response.flash = T("Hello World") > retur

[web2py] Re: Implementing Token Based authentication JWT

2017-06-27 Thread Oasis Agano
THE SOLUTION WAS THIS I wanted to write a web2py slice but i cant seem to login at the moment maybe i will do it later. Model Entries = db.define_table("entries", Field("entry", "text")) Cities = db.define_table("cities", Field("city", "text")) Controller def call(): """ exposes ser

[web2py] Re: Implementing Token Based authentication JWT

2017-06-27 Thread Oasis Agano
the message comes after i add the decorator on top of a function @myjwt.allows_jwt() On Friday, June 23, 2017 at 10:49:17 PM UTC+2, Oasis Agano wrote: > > Hello, > > How can someone implement a token based authentication in web2py; > Both token generation and authorization? > > > kr, > Oasis >

[web2py] Re: Implementing Token Based authentication JWT

2017-06-24 Thread Oasis Agano
Thank you for your useful answer but how do i pass the username and password because curl with them returns: *Invalid JWT header* when i try to get the login_and_take_token function. kr, Oasis On Friday, June 23, 2017 at 11:09:43 PM UTC+2, Dave S wrote: > > > > On Friday, June 23, 2017 at 1:4

[web2py] Re: Implementing Token Based authentication JWT

2017-06-23 Thread Dave S
On Friday, June 23, 2017 at 1:49:17 PM UTC-7, Oasis Agano wrote: > > Hello, > > How can someone implement a token based authentication in web2py; > Both token generation and authorization? > > gluon/tools.py line 1132 covers the JWT support Niphlod added. (line 1132 in version 2.14.6, that is) No