I've never used pyramid_jwtauth; just had a look at it.
Anyway, it should work like pyramids standard cookie auth except you have
to manage the yourself.

http://docs.pylonsproject.org/docs/pyramid/en/latest/_modules/pyramid/security.html#remember

But instead of calling 'remember()' you have to call pyramid_jwtauth's
'encode_jwt'

    policy = request.registry.queryUtility(IAuthenticationPolicy)
    if policy is None:
        token = None
    else:
        token = policy.encode_jwt(request, claims={'sub':'username'})

to get the signed token. The token has to be passed as header by the client
in the following requests.
'claims' have to include the username: I think  {'sub':'username'} should
work.
That's all. Or at least the rest has nothing to do with jwt tokens.

Arndt.



> I'm implementing a REST API in Pyramid and I want to use JSON Web Tokens
> for authorization and authentication (http://jwt.io/). I was looking at
> using a plugin pyramid_jwtauth
> <https://github.com/ajkavanagh/pyramid_jwtauth> but there are no examples
> or documentation on how to actually use it. If anyone has any experience or
> knowledge in implementing web tokens perhaps you could give me a few
> pointers for using it in Pyramid.
>
> -Vincent
>
>

Arndt Droullier / nive.io

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to