idp-auth-vite-bff

Integrates Overlens IDP login into a Vite SPA with a separate-origin BFF backend.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/overlens/claude-marketplace --skill idp-auth-vite-bff-overlens
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: idp-auth-vite-bff
Source: https://github.com/overlens/claude-marketplace/tree/main/plugins/idp-integration/skills/idp-auth-vite-bff
Command: npx skills add https://github.com/overlens/claude-marketplace --skill idp-auth-vite-bff-overlens

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Connecting a Vite single-page app to Overlens login when the backend lives on a different origin is notoriously tricky: the OAuth callback succeeds but every API call returns 401 because the browser silently withholds the cross-origin session cookie. This Skill guides the full integration and resolves the cross-origin cookie, CORS, and redirect problems specific to this split architecture. ## Core Features & Use Cases - Split-origin architecture guidance: Decision tree and three deployment topologies (dev proxy, same parent domain, unrelated domains) with the exact cookie attributes each one requires. - Copy-paste Vite templates: auth-api.ts fetch wrapper with credentials and silent 401-refresh-retry, AuthContext, ProtectedRoute, and a vite.config.ts dev proxy that eliminates the cross-origin problem in development. - BFF split tweaks: The three changes needed on top of a standard OAuth BFF — redirecting the callback back to the SPA origin, CORS with credentials, and a GET /auth/me endpoint. - Use Case: A developer has a React app on localhost:5173 and a NestJS API on localhost:4000 and wants Overlens login; the Skill wires the login navigation, session cookies, and route protection end to end. ## Quick Start Ask the assistant to add Overlens login to your Vite SPA that talks to a separate backend, and it will set up the BFF handlers, dev proxy, and React auth components for you.

Frequently Asked Questions about idp-auth-vite-bff

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Overlens login to a Vite React app with a separate backend?

Wire the Entrar button as a full navigation to the BFF /auth/login route, implement the OAuth handlers on the BFF, and use the provided auth-api.ts, AuthContext, and ProtectedRoute templates on the SPA. The BFF holds the client_secret and runs the Authorization Code + PKCE flow.

Why is my session cookie set but not sent on API calls from my Vite app?

The SPA and BFF are on different sites, so a SameSite=Lax cookie is withheld from cross-site fetch requests. Fix it with the Vite dev proxy for same-origin development, a shared parent domain with domain=.example.com, or SameSite=None with Secure.

Can I use fetch to call the BFF login endpoint?

No. Login and logout must be top-level navigations via window.location.href because the BFF responds with a 302 to the Overlens Accounts page, which fetch cannot drive. Only API calls after login use fetch with credentials: 'include'.

Does CORS with credentials allow a wildcard origin?

No. When credentials are included, the browser rejects Access-Control-Allow-Origin: * entirely. The BFF must echo the exact SPA origin and send Access-Control-Allow-Credentials: true, using cors({ origin, credentials: true }) in Express or NestJS.

When should I use this skill instead of a same-origin OAuth integration?

Use it only when the Vite SPA and the backend run on different origins and the backend holds the client_secret. If the backend serves the frontend on the same origin, or the SPA has no backend and uses PKCE-only, other integration guides fit better.