Documentation Index
Fetch the complete documentation index at: https://mintlify.com/scalekit-inc/developer-docs/llms.txt
Use this file to discover all available pages before exploring further.
Configure your Scalekit SDK with environment credentials and customize SDK behavior for your application needs.
Required Credentials
All Scalekit SDKs require three configuration values:
| Parameter | Description | Example |
|---|
| Environment URL | Your Scalekit environment endpoint | https://your-env.scalekit.com |
| Client ID | Your application’s client identifier | skc_12345678901234567 |
| Client Secret | Your application’s secret key | test_sk_abc123... |
Get Your Credentials
Retrieve your credentials from the Scalekit dashboard:
- Log in to Scalekit Dashboard
- Navigate to Dashboard > Developers > API Configuration
- Copy your Environment URL, Client ID, and Client Secret
Security: Never commit credentials to version control. Always use environment variables.
Environment Variables
Store credentials in environment variables:
SCALEKIT_ENVIRONMENT_URL=https://your-env.scalekit.com
SCALEKIT_CLIENT_ID=skc_12345678901234567
SCALEKIT_CLIENT_SECRET=test_sk_abc123def456ghi789jkl
Add .env to your .gitignore:
.env
.env.local
.env.production
SDK Initialization
Initialize the SDK with your credentials:
Framework-Specific Configuration
Node.js with Express
Load environment variables with dotenv:
import 'dotenv/config';
import express from 'express';
import { scalekit } from './utils/scalekit.js';
const app = express();
// SDK is now available via imported scalekit instance
app.get('/login', (req, res) => {
const url = scalekit.getAuthorizationUrl(...);
res.redirect(url);
});
Python with Flask
Load environment variables with python-dotenv:
from flask import Flask
from dotenv import load_dotenv
from utils.scalekit import scalekit_client
load_dotenv()
app = Flask(__name__)
@app.route('/login')
def login():
url = scalekit_client.get_authorization_url(...)
return redirect(url)
Go with Gin
Load environment variables with godotenv:
package main
import (
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"myapp/utils"
)
func main() {
godotenv.Load()
r := gin.Default()
r.GET("/login", func(c *gin.Context) {
url, _ := utils.scalekitClient.GetAuthorizationUrl(...)
c.Redirect(302, url.String())
})
r.Run(":8080")
}
Java with Spring Boot
Configure in application.properties:
scalekit.environment.url=${SCALEKIT_ENVIRONMENT_URL}
scalekit.client.id=${SCALEKIT_CLIENT_ID}
scalekit.client.secret=${SCALEKIT_CLIENT_SECRET}
Create a configuration bean:
import com.scalekit.ScalekitClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ScalekitConfig {
@Value("${scalekit.environment.url}")
private String environmentUrl;
@Value("${scalekit.client.id}")
private String clientId;
@Value("${scalekit.client.secret}")
private String clientSecret;
@Bean
public ScalekitClient scalekitClient() {
return new ScalekitClient(
environmentUrl,
clientId,
clientSecret
);
}
}
Expo (React Native)
Expo uses public configuration only (no client secret):
EXPO_PUBLIC_SCALEKIT_ENVIRONMENT_URL=https://your-env.scalekit.com
EXPO_PUBLIC_SCALEKIT_CLIENT_ID=skc_12345678901234567
import { Scalekit } from '@scalekit-sdk/expo';
// Mobile apps use public configuration only
export const scalekit = new Scalekit({
environmentUrl: process.env.EXPO_PUBLIC_SCALEKIT_ENVIRONMENT_URL,
clientId: process.env.EXPO_PUBLIC_SCALEKIT_CLIENT_ID,
});
Note: Never include client secrets in mobile applications. The Expo SDK handles authentication securely without requiring the secret.
Configuration Validation
Validate configuration on startup:
Multiple Environments
Manage different configurations for development, staging, and production:
Using Environment Files
SCALEKIT_ENVIRONMENT_URL=https://dev-env.scalekit.com
SCALEKIT_CLIENT_ID=skc_dev_12345
SCALEKIT_CLIENT_SECRET=test_sk_dev_abc123
SCALEKIT_ENVIRONMENT_URL=https://prod-env.scalekit.com
SCALEKIT_CLIENT_ID=skc_prod_67890
SCALEKIT_CLIENT_SECRET=prod_sk_xyz789
Load Based on Environment
Node.js:
import dotenv from 'dotenv';
const env = process.env.NODE_ENV || 'development';
dotenv.config({ path: `.env.${env}` });
Python:
import os
from dotenv import load_dotenv
env = os.getenv('FLASK_ENV', 'development')
load_dotenv(f'.env.{env}')
Redirect URI Configuration
Configure redirect URIs in the Scalekit dashboard:
- Navigate to Dashboard > Developers > API Configuration
- Add your redirect URIs:
- Development:
http://localhost:3000/auth/callback
- Staging:
https://staging.yourapp.com/auth/callback
- Production:
https://yourapp.com/auth/callback
- Mobile:
myapp://auth/callback
Security: Only add trusted redirect URIs. Scalekit validates the redirect URI on each authentication request.
Security Best Practices
Rotate Credentials Regularly
Rotate client secrets periodically:
- Generate new client secret in dashboard
- Update environment variables
- Deploy updated configuration
- Delete old client secret
Use Separate Credentials per Environment
Never reuse credentials across environments:
- Development environment: Use test credentials
- Staging environment: Use staging credentials
- Production environment: Use production credentials
Protect Environment Files
Restrict access to environment files:
chmod 600 .env
chmod 600 .env.production
Use Secret Management Services
For production, use secret management services:
- AWS Secrets Manager
- Google Cloud Secret Manager
- Azure Key Vault
- HashiCorp Vault
Example with AWS Secrets Manager (Node.js):
import { SecretsManagerClient, GetSecretValueCommand } from '@aws-sdk/client-secrets-manager';
async function getScalekitCredentials() {
const client = new SecretsManagerClient({ region: 'us-east-1' });
const response = await client.send(
new GetSecretValueCommand({ SecretId: 'scalekit/production' })
);
return JSON.parse(response.SecretString);
}
const credentials = await getScalekitCredentials();
const scalekit = new Scalekit(
credentials.environmentUrl,
credentials.clientId,
credentials.clientSecret
);
Troubleshooting
Invalid Environment URL
Ensure URL format is correct:
- ✅ Correct:
https://your-env.scalekit.com
- ❌ Wrong:
your-env.scalekit.com (missing https://)
- ❌ Wrong:
https://your-env.scalekit.com/ (trailing slash)
Invalid Client Credentials
Verify credentials match your dashboard:
- Check Client ID starts with
skc_
- Check Client Secret starts with
test_sk_ (development) or prod_sk_ (production)
- Ensure no extra whitespace in environment variables
Environment Variables Not Loading
Node.js: Ensure dotenv is loaded before importing SDK:
import 'dotenv/config'; // Load first
import { scalekit } from './utils/scalekit.js'; // Then import SDK
Python: Call load_dotenv() before importing SDK:
from dotenv import load_dotenv
load_dotenv() # Load first
from utils.scalekit import scalekit_client # Then import SDK
Next Steps