Identity headers for Enterprise apps
Your Enterprise app does not need its own login. sota Access checks every request before it reaches the app, and only requests from approved people with a grant for this app get through. Each of those requests carries three headers that tell the app who is signed in.
The headers
| Header | Value |
|---|---|
X-Sota-Access-User-Id | The person's ID in sota (a UUID). Stable for this person across all your apps; use it as the key when you store data per user. |
X-Sota-Access-Email | Their e-mail address from Microsoft 365, or their sign-in name if Entra has no e-mail for them. For display; it can change. |
X-Sota-Access-Name | Their display name from Microsoft 365. For display only. |
The headers are set by the sota edge. Any copy a browser sends is removed before the request is checked, so the app can trust them. They contain no role: today every person with a grant has the same rights inside the app. Roles inside apps come later.
Reading them
Node.js (Express)
app.get("/", (req, res) => {
const userId = req.get("X-Sota-Access-User-Id")
const name = req.get("X-Sota-Access-Name") || req.get("X-Sota-Access-Email")
res.send(`Hello ${name}`)
})
Next.js (App Router, server component or route handler)
import { headers } from "next/headers"
export default async function Page() {
const h = await headers()
const email = h.get("x-sota-access-email")
return <p>Signed in as {email}</p>
}
Python (Flask)
from flask import Flask, request
app = Flask(__name__)
@app.get("/")
def index():
user_id = request.headers.get("X-Sota-Access-User-Id")
email = request.headers.get("X-Sota-Access-Email")
return f"Signed in as {email}"
When you run the app on your own machine there is no sota Access in front of it, so the headers are missing. Use a fixed test user in development instead of failing.
Signing out
Link to /.sota/access/logout from inside your app:
<a href="/.sota/access/logout">Sign out</a>
It ends the sota session for this app and then sends the browser to Microsoft's sign-out page, which also signs the person out of Microsoft 365 in that browser. Paths under /.sota/access/ belong to sota Access; do not use them in your app.
Forms and requests
- Normal links, page loads, forms and
fetchcalls from your own pages work as usual. - Requests that change something (
POST,PUT,PATCH,DELETE) from another website are refused with "Request blocked". This protects apps without CSRF tokens. - When a session has ended, a
GETgoes back through the sign-in automatically; other methods get401and the page should reload. - Every path of the app is behind the sign-in, including API routes. Outside services (webhooks, scripts without a browser) cannot call the app.
Sessions
A session lasts at most 8 hours and ends after 1 hour without activity. A person who is blocked, or whose grant for this app is removed, loses access within a minute, also in an open session.