(I used this
link 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
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 ?