Overview
Astapa handles authentication and subscription state for your SaaS. Your users sign in on our hosted pages, we track which plan they're on, and your app reads a signed JWT to decide what to unlock.
Authentication
User signs in on Astapa's hosted login. Your server exchanges the authorization code for a JWT.
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"refresh_token": "rt_a1b2c3...",
"token_type": "Bearer",
"expires_in": 3600
}Feature gating
You assign a plan to a user via the Claims API. The next JWT carries that plan. Your app reads it and gates features.
{
"sub": "42",
"email": "user@example.com",
"custom_claims": {
"plan": "pro",
"role": "admin"
}
}Token refresh
Access tokens expire after 1 hour. Use the refresh token to get a new one without re-authenticating. This is typically done transparently in middleware.
Instant plan upgrade
After a purchase, set the new plan via Claims API, then immediately refresh the token. The user sees their new plan without waiting for the old JWT to expire.
Logout and revocation
Revoke all refresh tokens server-side, then clear cookies. The user can't refresh anymore.