Skip to content
Scalekit Docs
Go to Dashboard

Migrate to Full Stack Authentication

Migrating authentication is a big job. But moving to Scalekit pays dividends: you off-load SSO integrations, SCIM provisioning, session handling, and more—so your team can focus on product. This guide walks you through a safe, incremental migration from any existing solution to Scalekit’s full-stack auth platform.

This migration guide helps you:

  • Export user and organization data from your current system
  • Import data into Scalekit using APIs or SDKs
  • Update your application’s authentication flows
  • Test and deploy the new authentication system
  1. Before you switch to Scalekit, create a comprehensive inventory of your existing setup and export your data:

    Code audit:

    • Sign-up and login flows
    • Session middleware and token validation
    • Role-based access control (RBAC) logic
    • Email verification flows
    • Logout and session termination

    Data export:

    • User records (emails, names, verification status)
    • Organization/tenant structure
    • Role assignments and permissions
    • Authentication provider configurations (if using SSO)

    Backup plan:

    • Export a sample JWT token or session cookie to understand your current format
    • Set up a feature flag to route traffic back to the old system if needed
    • Document your rollback procedure

    The minimal user schema looks like this:

    FieldDescriptionStatus
    emailPrimary login identifier.Required
    first_nameThe user’s given name.Optional
    last_nameThe user’s family name.Optional
    email_verifiedBoolean flag. Treated as false if omitted.Optional
  2. Transform your exported data to match Scalekit’s format. The external_id field is crucial—it stores your original primary key, enabling seamless lookups between your system and Scalekit.

    npm install @scalekit-sdk/node

    Create organizations first:

    Create an organization
    curl "$SCALEKIT_ENVIRONMENT_URL/api/v1/organizations" \
    --request POST \
    --header 'Content-Type: application/json' \
    --data '{
    "display_name": "Megasoft Inc",
    "external_id": "org_123",
    "metadata": { "plan": "enterprise" }
    }'

    Then create users within organizations:

    Create a user inside an organization
    curl "$SCALEKIT_ENVIRONMENT_URL/api/v1/organizations/{organization_id}/users" \
    --request POST \
    --header 'Content-Type: application/json' \
    --data '{
    "email": "user@example.com",
    "external_id": "usr_987",
    "membership": {
    "roles": ["admin"],
    "metadata": { "department": "engineering" }
    },
    "user_profile": {
    "first_name": "John",
    "last_name": "Doe",
    "locale": "en-US"
    }
    }'
    • Batch your imports—run them in parallel for speed but respect rate limits
    • Include "sendInvitationEmail": false when creating users to skip invite emails. Scalekit will automatically set the membership status to active and mark the email as verified.

  3. The authentication callback URL is necessary for tokens to return safely. However, depending on your application, you may want to add more redirects (such as post-logout URLs, so you can control the user experience and destination after logout). Head to Settings → Redirects in the dashboard. Review our redirect URI guide for validation rules and wildcard configuration.

    Set up roles: Define roles in Scalekit to control what actions users can perform in your application. When users log in, Scalekit provides their assigned roles to your application.

    • Create your roles under User Management → Roles or via the SDK
    • While importing users, include the roles array in the membership object. Read more about roles.
    • Need organization-specific roles? Reach out to discuss your requirements

  4. Replace session middleware: Replace legacy JWT validation with the Scalekit SDK or our JWKS endpoint. Verify:

    • Access tokens are accepted across all routes
    • Refresh tokens renew seamlessly
    • Ensure your application’s checks use the roles claim from Scalekit’s tokens (learn more)

    Customize your Login Page: Your application redirects users to a Scalekit-hosted login page. Tailor the experience by updating your logo, colours, copy, and legal links in the dashboard.

    Update secondary flows:


  5. Execute your migration carefully with proper monitoring:

    Pre-deployment testing:

    • Test login flows with a few migrated users
    • Verify session management and token validation
    • Check role-based access control

    Deployment steps:

    1. Deploy your updated application code
    2. Enable the feature flag to route traffic to Scalekit
    3. Monitor authentication success rates and error logs
    4. Have your rollback plan ready

    Post-deployment monitoring:

    • Watch authentication error rates
    • Monitor session creation and validation
    • Check user feedback and support tickets
    • Verify SSO connections work correctly
Why can’t users log in after migration?
  • Verify callback URLs are registered in Scalekit dashboard
  • Check that external_id mappings are correct
  • Ensure email addresses match exactly between systems
Why is session validation failing?
  • Update JWT validation to use Scalekit’s JWKS endpoint
  • Verify token expiration and refresh logic
  • Check that role claims are read correctly
Why aren’t SSO connections working?
  • Confirm organization has SSO enabled in features
  • Verify identity provider configuration
  • Test with IdP-initiated login