OAuth2 Authorization Code Flow
This is the primary authentication method for browser-based users. SoCMate uses Azure Entra ID (formerly Azure AD) as the identity provider.User authenticates
Redirect the user to the
auth_url. They authenticate with Azure Entra ID and complete MFA if required. Azure redirects back to your redirect_uri with an authorization code:Exchange code for tokens
Send the authorization code to the API:Response:The response also sets three httpOnly cookies:
access_token— JWT for API authorizationrefresh_token— token for renewaltoken_expiry— expiration timestamp (readable by client-side JavaScript)
Token Refresh
Access tokens expire after a configurable period (default: 30 minutes). Use the refresh endpoint to obtain new tokens:token_expiry cookie (not httpOnly) can be read by client-side JavaScript to proactively refresh before expiration.
The SoCMate UI automatically handles token refresh. If you are building a custom integration, check the
token_expiry cookie and refresh the token before it expires.API Key Authentication
API keys provide a simpler authentication method for automated integrations, scripts, and CI/CD pipelines. They do not require the OAuth2 flow.Using an API Key
Pass the API key in theX-API-Key header:
API Key Scopes
Each API key is scoped to specific permissions:| Scope | Permissions |
|---|---|
investigations:read | Read investigation sessions and results |
investigations:write | Start investigations, send follow-ups |
incidents:read | List and view Sentinel incidents |
search:read | Search investigations and entities |
graph:read | Query the knowledge graph |
403 Forbidden.
Key Format
API keys follow the formatsk_live_{key_id}{random_secret}. The key_id prefix is visible in the admin panel and in API responses; the full key is only shown once at creation time.
OAuth2 Client Credentials Flow
For service-to-service integrations (SOAR platforms, ticketing systems, custom automation), use the OAuth2 Client Credentials flow.Create an API Client
An admin creates an API client in the SoCMate Admin panel. See API Clients for details.
Cookie Security
When using the browser-based OAuth2 flow, tokens are stored in cookies with the following security settings:| Cookie | httpOnly | Secure | SameSite | Purpose |
|---|---|---|---|---|
access_token | Yes | Yes | Lax | API authorization JWT |
refresh_token | Yes | Yes | Lax | Token renewal |
token_expiry | No | Yes | Lax | Client-side expiry check |
- httpOnly prevents JavaScript from reading the token (XSS protection)
- Secure ensures cookies are only sent over HTTPS
- SameSite=Lax prevents CSRF for most cross-site requests
- token_expiry is intentionally not httpOnly so the UI can check if a refresh is needed
User Info
Retrieve the authenticated user’s profile:Roles and Permissions
SoCMate uses role-based access control (RBAC) with two roles:| Role | Permissions |
|---|---|
analyst | View and create investigations, search, view knowledge graph, manage own profile |
admin | All analyst permissions plus user management, SIEM provider configuration, LLM model management, API key and client management |
analyst role on first login. Admins can promote users via the Admin panel.
