Backend for Frontend (BFF) Pattern
Pattern where a server-side backend acts as the confidential OAuth/OIDC client for a single-page app, keeping tokens out of the browser and giving the SPA only an HttpOnly session cookie.
The Backend for Frontend (BFF) pattern moves the OAuth 2.0 / OpenID Connect client role from a single-page application (SPA) running in the browser to a server-side backend. The backend is a confidential client: it runs the authorization code flow, stores the ID, access, and refresh tokens, and calls APIs on the SPA's behalf. The SPA never sees a token. It only holds a session cookie that is valid solely against the BFF.
This diagram shows the login through the BFF followed by an API call proxied by the backend.