skillfed

scitokens

SciToken reference implementation library

scitokens v1.9.7 95.8K downloads/30d#13,250 on PyPI7
Permissive license Apache-2.0 Active released

What it is and what it does

SciTokens is a reference implementation library for the SciTokens JWT token format, designed to provide a high-level, safe interface for creating and validating authorization tokens in scientific computing workflows. It wraps PyJWT and cryptography to handle the low-level details of token signing, serialization, and verification, letting you focus on defining authorization claims and validation logic.

The library separates token verification (checking cryptographic integrity and authenticity) from validation (checking whether claims satisfy your authorization requirements). You can generate tokens with arbitrary claims, serialize them to a standard JWT format, deserialize and verify tokens from external sources, and use the Enforcer class to test whether a token grants specific permissions—such as read/write access to particular file paths. It also includes utilities for creating demo tokens and a Flask decorator for protecting endpoints.

Use it for:

  • Generate and sign authorization tokens in an OAuth2 workflow for scientific computing infrastructure
  • Validate incoming tokens at a storage or compute service to enforce access control policies
  • Test token-based authorization logic in development using the demo token generator
  • Enforce path-based access control (e.g., read/write permissions on specific directories) using the Enforcer class
  • Protect Flask endpoints with token-based authentication and scope validation

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Implements the SciTokens JSON Web Token (JWT) format for generating, validating, and enforcing authorization claims in scientific computing environments.

Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It is the reference implementation for SciTokens, making it the natural choice if you need to work with this token format in scientific computing environments. Install it if you are building or integrating with systems that use SciTokens for authorization.

Install

scitokens on PyPI

pip

pip install scitokens

uv

uv add scitokens

poetry

poetry add scitokens

Installing scitokens

Before you install

Low friction installation with three stable runtime dependencies (cryptography, PyJWT, requests). Actively maintained with recent commits and no known vulnerabilities.

License in practice

Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions beyond attribution.

Quickstart

import scitokens

# Generate a new token
token = scitokens.SciToken()
token['read'] = '/ligo'
serialized = token.serialize()

# Deserialize and validate
token = scitokens.SciToken.deserialize(serialized)
val = scitokens.Validator()
val.add_validator('read', lambda v: v.startswith('/'))
val.validate(token)

Verify before relying

  • Whether the demo token generator endpoint (demo.scitokens.org) is reliably available for production use
  • Performance characteristics when validating large numbers of tokens concurrently
  • Compatibility with Python versions beyond 3.10 (classifiers list 3.5–3.10 but current support is unclear)

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.5)
Install friction low — pure-Python wheel
Runtime dependencies 3 — cryptography, PyJWT, requests
Maintenance actively maintained — 154 days since the last release
Last repo commit
First released
Downloads 95,770/month — #13,250 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: scitokens-1.9.7-py3-none-any.whl

Development Status :: 5 - Production/StableLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering

Tags

JWT token librarySciTokens implementationauthorization token validationscientific computing tokenstoken-based access controlcryptographic token signingOAuth2 token handling
jwt-tokensscientific-computingaccess-control

More Scientific/Engineering packages