WESB ID Integration Guide
1. Purpose
WESB ID is the central identity platform for Weststar internal applications.
In the current product, WESB ID is no longer only a user-lookup service. It is now the hosted login authority for connected internal applications.
That means:
- the connected site does not store the user's WESB ID password
- the user signs in on WESB ID itself
- WESB ID returns a short-lived one-time auth code to the connected site
- the connected site exchanges that auth code server-to-server using its site-owned
X-Service-Key - the connected site can then auto-provision or update its own local linked user by
wesb_user_id
This guide is written for a developer who does not have access to the WESB ID admin panel. You can read this guide publicly, but you cannot complete the integration alone. A WESB ID administrator must register your site, configure its policy, approve its callback URLs, and generate its service key before integration is valid.
2. Current Integration Model
The primary integration model is now:
- site registration by WESB ID Super Admin
- callback URL approval
- service-key generation
- browser redirect to hosted WESB ID login
- successful callback with one-time auth code
- backend auth-code exchange using
X-Service-Key - local linked-user auto-provision by
wesb_user_id
The older resolve and token endpoints still exist, but they are no longer the main login delegation path.
3. Important Terminology
3.1 Site Registration
Site Registration is the admin-managed process of creating your application inside the WESB ID Site Registry.
A registered site stores metadata such as:
site_keysite_namebase_urlsupport_labellogo_urlbrand_colorstatusservice_key_prefixservice_key_last_used_at
Operational meaning:
- the site record is the governance record for your application
- the approved
site_keyis the canonical application identifier - the site must be active before hosted login or backend exchange will work
3.2 Site Policy
Site Policy is the per-site authentication contract managed by WESB ID admin.
In the current product, the policy surface includes:
auth_modehosted_login
login_modepassword_onlyotp_required
reset_modereset_linkotp_email
allow_password_resetenforce_2faallowed_origins_jsoncallback_urls_json
Operational meaning:
auth_mode = hosted_loginmeans the connected site must redirect users to WESB ID instead of verifying passwords locallycallback_urls_jsonis part of the trust boundarylogin_modeandenforce_2facontrol whether hosted login finishes after password entry or requires email OTP
3.3 Service Key
Each approved site can own one active service key at a time.
Current behavior:
- generated by WESB ID Super Admin from the Sites screen
- shown once immediately after generation or rotation
- stored only as a hash plus visible prefix
- rotation invalidates the previous key immediately
- used only for trusted backend calls, never in frontend code
3.4 Hosted Login Auth Code
After a successful hosted WESB ID login, WESB ID creates a short-lived one-time authorization code.
Current behavior:
- bound to one site
- bound to one approved callback URL
- short-lived
- single-use
- exchanged server-to-server
3.5 Auxiliary Service APIs
WESB ID still exposes:
GET /api/service/resolvePOST /api/service/token
These can still be used for auxiliary identity lookups or internal trusted flows, but they are not the primary delegated-login handoff anymore.
4. What You Can and Cannot Do Without Admin Access
You can do
- prepare your application metadata
- prepare callback URLs and origin lists
- implement the redirect and backend exchange flow in your application
- test request formatting and response handling
- use this document to align with the current WESB ID contract
You cannot do
- register your own site
- approve your own callback URLs
- generate your own authoritative service key
- rotate a site service key
- bypass WESB ID hosted login and still claim the integration is complete
5. Information You Must Send to WESB ID Admin
Before development sign-off, send the following to the WESB ID admin team:
- Site name
- Proposed
site_key - Base URL
- Support label
- Allowed frontend origins
- Callback URLs
- Desired hosted login mode
- Desired reset mode
- Whether password reset must be allowed
- Whether 2FA must be enforced
Recommended request template:
Site name: ATP Console
Site key: atp
Base URL: https://atp.weststar-dev.com
Support label: ATP Support
Allowed frontend origins:
- https://atp.weststar-dev.com
- https://staging-atp.weststar-dev.com
Callback URLs:
- https://atp.weststar-dev.com/auth/callback
- https://staging-atp.weststar-dev.com/auth/callback
Desired auth mode: hosted_login
Desired login mode: otp_required
Desired reset mode: reset_link
Allow password reset: yes
Enforce 2FA: yes
6. What You Should Expect Back From WESB ID Admin
The WESB ID admin team should provide:
- confirmation that the site was registered
- the approved
site_key - the final site policy values
- the approved callback URL(s)
- the site-owned service key or the approved secure handoff process for it
- the WESB ID base URL for the environment you are integrating with
Minimum outcome before implementation sign-off:
- your team knows the exact hosted-login URL to redirect to
- your team knows the exact callback URL that WESB ID will accept
- your backend has received the site-owned service key securely
7. Step-by-Step Hosted Login Integration
Step 1. Prepare application metadata
Developer action:
- collect the registration data listed above
- decide the exact callback URL(s) your backend will accept
Expected result:
- you have a complete site-registration request for WESB ID admin
Step 2. Contact WESB ID admin
Developer action:
- send the registration package
- explicitly state that your application will use hosted WESB ID login
Expected result:
- WESB ID admin reviews the site metadata, callback URLs, and login policy
Step 3. WESB ID admin registers the site
Admin-side action:
- create the site record in the Site Registry
Expected result:
- your application exists in WESB ID as a registered site
Step 4. WESB ID admin configures Site Policy
Admin-side action:
- set
auth_mode = hosted_login - configure login mode, reset mode, password reset allowance, 2FA enforcement, allowed origins, and callback URLs
Expected result:
- your application has an explicit hosted-login policy contract
Step 5. WESB ID admin generates the site service key
Admin-side action:
- generate the site service key from the Sites modal
- copy the one-time revealed plaintext key
Expected result:
- the site now has one active backend integration key
Step 6. Store WESB ID settings in your application
Developer action:
- store the WESB ID base URL
- store the approved
site_key - store the site-owned service key in backend-only environment configuration
Recommended environment variables in the connected application:
WESB_ID_BASE_URL=https://id.weststar-dev.com
WESB_ID_SITE_KEY=atp
WESB_ID_LOGIN_URL=https://id.weststar-dev.com/connect/login
WESB_ID_CALLBACK_URL=https://atp.weststar-dev.com/auth/callback
WESB_ID_SERVICE_KEY=replace-with-approved-site-service-key
Expected result:
- your application can redirect users to WESB ID and perform authenticated backend exchange
Step 7. Redirect users to hosted WESB ID login
Developer action:
- when a user clicks your app's login entry point, redirect them to:
GET https://id.weststar-dev.com/connect/login?site_key=YOUR_SITE_KEY&redirect_uri=YOUR_CALLBACK_URL&state=YOUR_STATE
Expected result:
- WESB ID renders a hosted login page for your registered site
- if the callback URL is not approved, WESB ID rejects the request
Step 8. Handle the callback
After successful WESB ID login:
- WESB ID redirects the browser back to your callback URL
- the callback query includes:
code- optional
state
Example:
https://atp.weststar-dev.com/auth/callback?code=ONE_TIME_CODE&state=abc123
Expected result:
- your backend receives a one-time authorization code
Step 9. Exchange the auth code server-to-server
Developer action:
- your backend calls WESB ID with the site-owned service key
- do not perform this exchange from frontend JavaScript
Example:
curl -X POST "https://id.weststar-dev.com/api/service/exchange" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Service-Key: YOUR_SITE_SERVICE_KEY" \
-d "{\"code\":\"ONE_TIME_CODE\"}"
Expected success response:
{
"data": {
"wesb_user_id": 123,
"email": "staff.user@weststar.com",
"full_name": "Staff User",
"first_name": "Staff",
"last_name": "User",
"status": "active",
"role": "staff",
"department": "Technology",
"job_title": "Developer",
"profile_photo_url": null
}
}
Expected result:
- your backend now has trusted identity data from WESB ID
- your app can auto-provision or update its own linked local user by
wesb_user_id - your app can then start its own local session
Step 10. Auto-provision the local app user
Developer action:
- find a local user by
wesb_user_id - if not found, create one
- if found, update profile fields as needed
Recommended minimum local linkage:
wesb_user_idemailfull_name- your app-specific role / team / ownership fields
Do not copy:
- the WESB ID password
- the WESB ID password hash
Expected result:
- users can log into the new site without separate site registration
- WESB ID remains the single password authority
8. Auxiliary Backend APIs
8.1 Resolve WESB user
Purpose:
- look up a WESB ID user by email or WESB user id
Example:
curl -X GET "https://id.weststar-dev.com/api/service/resolve?email=staff.user@weststar.com" \
-H "Accept: application/json" \
-H "X-Service-Key: YOUR_SITE_SERVICE_KEY"
8.2 Auxiliary lightweight token
Purpose:
- request an auxiliary lightweight token payload for trusted internal workflows
This is no longer the main delegated-login callback contract.
Example:
curl -X POST "https://id.weststar-dev.com/api/service/token" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Service-Key: YOUR_SITE_SERVICE_KEY" \
-d "{\"wesb_user_id\":123}"
9. Required Negative Tests
9.1 Missing service key
Request:
curl -X POST "https://id.weststar-dev.com/api/service/exchange" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d "{\"code\":\"ONE_TIME_CODE\"}"
Expected result:
{
"message": "Invalid service key."
}
9.2 Invalid service key
Request:
curl -X POST "https://id.weststar-dev.com/api/service/exchange" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Service-Key: WRONG_VALUE" \
-d "{\"code\":\"ONE_TIME_CODE\"}"
Expected result:
401 Invalid service key.
9.3 Invalid callback URL
Operational test:
- try to open hosted login with a callback URL that is not listed in the site's approved callback URLs
Expected result:
- WESB ID rejects the request
9.4 Reused auth code
Operational test:
- exchange the same
codetwice
Expected result:
- first exchange succeeds
- second exchange fails
9.5 Cross-site exchange attempt
Operational test:
- obtain a valid auth code for site A
- try to exchange it with site B's
X-Service-Key
Expected result:
- WESB ID rejects the exchange
10. Expected Results Summary
When integration is configured correctly:
- the site is registered and active in WESB ID
- hosted-login callback URLs are approved
- the site has one active service key
- the connected site redirects users to WESB ID for login
- WESB ID returns a one-time auth code to the approved callback URL
- the connected backend exchanges that code successfully using
X-Service-Key - the connected site auto-provisions or updates its local linked user by
wesb_user_id - the connected site never stores the user's WESB ID password
11. Integration Complete Checklist
- Site registration request sent to WESB ID admin
- Site registration approved
- Approved
site_keyreceived - Approved callback URL(s) received
- Hosted login policy confirmed
- WESB ID base URL stored in your environment
- Site-owned service key stored securely in backend environment
/connect/login?site_key=...&redirect_uri=...tested successfully- Callback with
codeobserved successfully POST /api/service/exchangetested successfully- Missing-key request verified to fail with
401 - Invalid-key request verified to fail with
401 - Reused-code request verified to fail
- Local linked-user auto-provision confirmed
- No WESB ID password stored locally
12. Final Technical Notes
- WESB ID is an internal Weststar identity provider, not a public self-service platform
- do not expose the site service key in frontend code, committed source, or public logs
- do not bypass hosted login by asking the connected site to verify WESB ID passwords locally
- if your integration needs more fields at exchange time, raise the requirement with WESB ID admin instead of inventing a private unsupported contract