ahem. a GET instead of a POST.

On Wednesday, July 27, 2016 at 8:56:32 AM UTC+2, Abdu Adil wrote:
>
> (I used this link <http://web2py.readthedocs.io/en/latest/tools.html> to 
> add jwt())
>
> I want to use restful API with JWT, so I did this
>
> auth = Auth(db, host_names=myconf.get('host.names'), jwt = {'secret_key':
> 'secret'})
>
> Then in defaults controller I have this
>
> def user():
>     return dict(form=auth())
>
> In my api controller i have
>
> @request.restful()
> @auth.allows_jwt()
> @auth.requires_login()
> def role():
>         response.view = 'generic.json'
>         def GET(id):
>             return dict(roles = db().select(db.role.ALL))
>
>         def POST(tablename, **fields):
>             return db.roles.validate_and_insert(**fields)
>
>         return locals()
>
> When I try to log in first with POST request on this path
>
>
> http://127.0.0.1:8000/runningTracker/default/user/jwt?username=123&password=123
>
> I get
>
> Not Authorized - need to be logged in, to pass a token for refresh or 
> username and password for login
>
> What do I need to fix here ?
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to