Authentication
The Lupyd Server authenticates users with JSON Web Tokens issued by Auth0. Send the token on every request:
Authorization: Bearer <access-token>The Bearer prefix (with a single space) is required.
Token verification
Section titled “Token verification”A token is accepted when all of the following hold:
| Check | Requirement |
|---|---|
| Signature | RS256, verified against the JWKS at https://<AUTH0_DOMAIN>/.well-known/jwks.json, selected by the kid header. Keys are cached according to the JWKS response’s cache headers. |
exp |
Not in the past. |
iss |
Exactly equal to the configured AUTH0_ISSUER. |
aud |
A JSON array that contains "https://lupyd.com". |
The server reads three claims:
| Claim | Meaning |
|---|---|
sub |
The Auth0 user ID. |
uname |
The Lupyd username. Empty until the user completes sign-up. |
perms |
A 64-bit permission bitmask (see below). 0 until sign-up completes. |
Optional and required authentication
Section titled “Optional and required authentication”- Optional-auth endpoints (most
GETreads) treat a missing or invalid token as an anonymous request. Signing in can change the response — for example, authors see their own expired posts and private settings. - Required-auth endpoints return
401 Unauthorizedwith a plain-text reason, such asMissing Authorization Header,Token is expired, orYou are missing some permissions.
Permissions
Section titled “Permissions”Each endpoint in the API reference lists the permission bit it requires.
| Permission | Bit | Grants |
|---|---|---|
AdministrativePrivileges |
1 |
Administrative operations. |
UserChatList |
2 |
Read chat sessions and notifications. |
UpdateUserChat |
4 |
Manage chat keys and chat sessions. |
CreateFile |
8 |
Upload files. |
UpdatePost |
16 |
Create, edit, delete, vote on, share, and report posts. |
UpdateUser |
32 |
Edit or delete your profile, manage relations, save posts. |
CreateGroup |
64 |
Create groups. |
UserTokensHandle |
128 |
Manage tokens. |
ManageAds |
256 |
Manage ads. |
A regular user receives 254 (every bit except AdministrativePrivileges).
Sign-up flow
Section titled “Sign-up flow”New Auth0 accounts have no username and perms = 0. To finish creating a Lupyd account:
- Sign the user in with Auth0 and obtain an access token for the audience
https://lupyd.com. - Call
POST /userwith alupyd.user.FullUserbody containing the chosenuname. - The server creates the profile and writes
unameandperms: 254to the user’s Auth0app_metadata. - Refresh the access token. The new token carries
unameandperms, and is required for every other authenticated endpoint.
Signing out everywhere
Section titled “Signing out everywhere”DELETE /sessions revokes the
user’s Auth0 refresh tokens and sessions. Existing access tokens stay valid until they
expire, so keep access-token lifetimes short.