Skip to main content


Project description

NOTE: This is an early version of the code is the library is likely to change.

This is a Pyramid authenitcation plugin for JSON Web Token (JWT) Authentication:

To access resources using JWT Access Authentication, the client must have obtained a JWT to make signed requests to the server. This library also makes JSON Web Tokens for the client. The Token can be opaque to client although, unless it is encrypted, the client can read the claims made in the token.

When accessing a protected resource, the server will generate a 401 challenge response with the scheme “JWT” as follows:

> GET /protected_resource HTTP/1.1
> Host:

< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: JWT

The client will use their JWT to build a request signature and include it in the Authorization header like so:

> GET /protected_resource HTTP/1.1
> Host:
> Authorization: JWT token=eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt

< HTTP/1.1 200 OK
< Content-Type: text/plain
< For your eyes only:  secret data!

(NB depending on the number of claims in the JWT the token can get large. For all practical purposes, it should be kept short.)

This plugin uses the PyJWT library for verifying JWTs:

Also see the library for generating the JWT for the client in the first place although any language can be used to generate it.


This module is heavily based on (and copied from) the Mozilla Services pyramid_macauth package and macauthlib package:

Without it, I would not have been able to make the small number of modifications to this package and get it to work with Pyramid.


This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at


  • Initial dev version 0.0.1.dev1.

Forked from version 0.4.0-dev1


Updated package requires to need PyJWT.


Updated package so that it can be downloaded for use by Python 3.3/3.4


Now works properly with RSA keys and fixed issue with not doing a 401 with the appropriate challenge. Dropped support for Python 2.6 and 3.2

Project details

Release history Release notifications

History Node


History Node


History Node


History Node


This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pyramid_jwtauth-0.0.1.dev5.tar.gz (17.3 kB) Copy SHA256 hash SHA256 Source None May 2, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page