Hosted auth pages, managed sessions, secure logout. Purpose built. Simple where it counts
You’ll implement sign-up, login, and logout flows with secure session management and user management included. The foundation you build here extends to features like workspaces, enterprise SSO, MCP authentication, and SCIM provisioning.
See DemoPlay See the integration in actionPlay Review the authentication sequence
Scalekit handles the complex authentication flow while you focus on your core product:
User initiates sign-in - Your app redirects to Scalekit’s hosted auth page
Identity verification - User authenticates via their preferred method
Secure callback - Scalekit returns user profile and session tokens
Session creation - Your app establishes a secure user session
Protected access - User accesses your application’s features
An authorization URL is an endpoint that redirects users to Scalekit’s sign-in page. Use the Scalekit SDK to construct this URL with your redirect URI and required scopes.
Register redirect URLs in your Scalekit dashboard
Before creating the authorization URL, register redirect URLs in your Scalekit dashboard. Go to Scalekit dashboard → Authentication → Redirect URLs and configure:
Allowed callback URL: The endpoint where Scalekit sends users after successful authentication. The redirect_uri in your code must match this URL exactly. Learn more
Initiate-login URL: Required when authentication is not initiated from your app-for example, when a user accepts an organization invitation or starts sign-in directly from their identity provider (IdP-initiated SSO). Learn more
Now, you can create an authorization URL to redirect users to the login page.
This redirects users to Scalekit’s managed sign-in page where they can authenticate. The page includes default authentication methods for users to toggle between sign in and sign up.
After successful authentication, Scalekit creates a user record and sends the user information to your callback endpoint.
In authentication flow, Scalekit redirects to your callback URL with an authorization code. Your application exchanges this code for the user’s profile information and session tokens.
user - Common user details with email, name, and verification status
idToken - JWT containing verified full user identity claims (includes: sub user ID, oid organization ID, email, name, exp expiration)
accessToken - Short-lived token that determines current access context (includes: sub user ID, oid organization ID, roles, permissions, exp expiration)
refreshToken - Long-lived token to obtain new access tokens
The user details are packaged in the form of JWT tokens. Decode the idToken to access full user profile information (email, name, organization ID) and the accessToken to check user roles and permissions for authorization decisions. See Complete login with code exchange for detailed token claim references and verification instructions.
The access token is a JWT that contains the user’s permissions and roles. It expires in 5 minutes (default) but can be configured. When it expires, use the refresh token to obtain a new access token. The refresh token is long-lived and designed for this purpose.
The Scalekit SDK provides methods to refresh access tokens automatically. However, you must log the user out when the refresh token itself expires or becomes invalid.
This sets browser cookies with the session tokens. Every request to your backend needs to verify the accessToken to ensure the user is authenticated. If expired, use the refreshToken to get a new access token.
Authenticated users can access your dashboard. The app enforces session policies using session tokens. To change session policies, go to Dashboard > Authentication > Session Policy in the Scalekit dashboard.
Session persistence depends on the session policy configured in the Scalekit dashboard.
To log out a user, clear local session data and invalidate the user’s session in Scalekit.
// Note: This is a one-time use URL that becomes invalid after use
24
returnnewRedirectView(logoutUrl.toString());
25
}
26
}
The logout process completes when Scalekit invalidates the user’s session and redirects them to your registered post-logout URL.
This single integration unlocks multiple authentication methods, including Magic Link & OTP, social sign-ins, enterprise single sign-on (SSO), and robust user management features. As you continue working with Scalekit, you’ll discover even more features that enhance your authentication workflows.