User onboarding
How users are created, authenticated, and managed when you build on AISquare.
AISquare supports per-user identity and personalization. Instead of one shared account, give each of your users their own AISquare account, created programmatically from your backend. Your platform owns sign-up; AISquare owns identity, activity, personalization, and metrics for each user.
Recommended approach
Register users through the API and hold a per-user API key for each one. Your users never sign up with AISquare directly.
User lifecycle
A user moves through these stages:
User signs up on your platform
|
Backend registers the user in AISquare
|
AISquare returns an API key
|
Backend stores the key
|
User interacts with AISquare-powered featuresOnboarding a user
Register the user
When a new user is created on your platform, call the AISquare registration API to create a matching AISquare user. Registration is programmatic, so your users do not sign up by hand. They may receive an automated welcome email.
Store the credentials
Store the returned API key securely on your backend and associate it with your own user ID.
{
"user_id": "user_123",
"aisquare_api_key": "api_key_xyz"
}Authenticate requests
When the user acts in your app, your backend retrieves their key and calls AISquare on their behalf.
Authorization: Bearer <api_key>Personalize
Because each user has a unique account, AISquare can track their activity, engagement, and performance, and use it to drive personalized content, adaptive difficulty, leaderboards, and per-user analytics.
Token-based flow (alternative)
Instead of sending the API key on every call, you can exchange it for tokens. Log in with the key, receive an access token and a refresh token, then send the access token the way you would the key. Refresh it when it expires.
| Token | Expiry |
|---|---|
| Access token | 7 days |
| Refresh token | 30 days |
See Token lifecycle for the full flow, including how to detect expiry and refresh safely.
Mapping users between systems
Keep a mapping between your platform user ID and the AISquare user (or their key) so identity stays consistent across both systems.
your_user_id -> aisquare_user_id / api_keyWhy not a shared account
Using one AISquare account for every user merges their data: mixed activity, no personalization, inaccurate metrics, and broken leaderboards. Per-user accounts give you accurate activity tracking, personalized recommendations, meaningful metrics, and user management that scales.
Best practices
- Register lazily. Create an AISquare user only when you first need one.
- Store keys securely. Keep keys in encrypted storage on the backend, never in the frontend. See Authentication.
- Avoid duplicates. Make sure a user is not registered more than once.
- Monitor the flow. Track registration failures and retry them.
Putting it together
- The user signs up on your platform.
- Your backend registers the user in AISquare.
- The key is stored securely.
- Your backend uses the key for requests.
- AISquare tracks the user's activity.