pgjwt
JSON Web Token API for Postgresql
Overview
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4160 | pgjwt | No | Yes | No | Yes | No | No | - |
| Related | pgcrypto pg_oidc_validator pg_session_jwt pgsodium oidc_validator login_hook sslinfo sslutils pgcrypto pguecc pgcryptokey |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.2.0 | 1817161514 | pgjwt | pgcrypto |
| RPM | PIGSTY | 0.2.0 | 1817161514 | pgjwt_$v | - |
| DEB | PIGSTY | 0.2.0 | 1817161514 | postgresql-$v-pgjwt | - |
Build
You can build the RPM / DEB packages for pgjwt using pig build:
Install
You can install pgjwt directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
Requires the pgcrypto extension.
Sign a Token
Returns a JWT string like: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOi...
Verify a Token
Returns:
| header | payload | valid |
|---|---|---|
{"alg":"HS256","typ":"JWT"} | {"sub":"1234567890","name":"John Doe","admin":true} | t |
Algorithm Selection
sign() and verify() accept an optional third argument for the algorithm: 'HS256' (default), 'HS384', or 'HS512'.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)