Registry / auth / jsonwebtokens

jsonwebtokens

JSON →
library1.2.0rscratesunverified

A Rust implementation of JSON Web Tokens (JWT) for encoding and decoding tokens.

# Cargo.toml [dependencies] jsonwebtokens = "1.2.0"
INSTALL
IMPORT
SIG · JSONWEBTOKENS
J
jsonwebtokens
authrustv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encode
use jsonwebtokens::encode;

Encoding a JWT token.

use jsonwebtokens::{encode, Header, EncodingKey}; fn main() { let header = Header::default(); let claims = serde_json::json!({ "sub": "123" }); let token = encode(&header, &claims, &EncodingKey::from_secret("secret".as_bytes())).unwrap(); println!("{}", token); }
Debug
Known issues
gotchaRequires the 'serde' feature for JSON serialization.
fix
Add 'features = ["serde"]' to Cargo.toml dependency.
affects: *
Upgrade
Version history
1.2.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
jsonwebtokens — cargo add jsonwebtokens · libregistry