Backend
Auth & secrets
Authenticate users, authorise every action, and keep API keys out of code, prompts and logs.
What it is and why it exists
Users authenticate via OIDC/OAuth (or SSO for enterprises); the backend authorises each request and tool call. Provider API keys and tool credentials live in a secrets manager, are rotated, scoped per environment and never sent to the browser or the model.
Quick prototype
API key in .env, committed once by accident.
In production, at scale
SSO (SAML/OIDC) for enterprise customers, short-lived sessions or JWTs, server-side authorisation checks, secrets in a manager with rotation, separate keys per environment and service, and secret scanning in CI.
Vendors and tools
| Auth0 / Clerk / Okta / Entra ID | Identity providers |
|---|---|
| HashiCorp Vault / Doppler | Secrets management |
| gitleaks / GitHub secret scanning | Leak detection |
On AWS: Cognito or IAM Identity Center; Secrets Manager and Parameter Store; IAM roles instead of static keys.
How it fails
- Provider key in frontend code
- Tool credentials pasted into the system prompt
What the interviewer asks next
Why never put the provider key in the browser?
Anyone can read it and spend your money or exhaust your limits. Route calls through your backend (or issue short-lived scoped tokens where the provider supports them).