Skip to main content

Small and simple Python library to parse JWT tokens embedded in http auth. headers.

Project description

Python Auth. Header Parser

A small and simple library to parse JWT tokens embedded in Authorization or Authentication HTTP headers.

Note: This library does not decode the JWT token. It simply extracts the JWT token string from the header string.

Usage

from py_auth_header_parser import parse_auth_header

header = "Authorization: Bearer AAA, Refresh BBB"
parsed = parse_auth_header(header)

# 'parsed' will then contain:
{
  "access_token": "AAA",
  "refresh_token": "BBB",
}

parse_auth_header() will always return a dict with two keys: access_token and refresh_token.
When a refresh token is no present in the header, the refresh_token key will be None.

Project details


Download files

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

Files for py-auth-header-parser, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size py_auth_header_parser-1.0.2-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size py_auth_header_parser-1.0.2.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

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