authentication-proxy

Enforces server-side Next.js API proxy routes for Supabase authentication and DaaS backend requests.

Updated May 27, 2026
One-click install
npx skills add https://github.com/Rkaaaa404/cyberhack-SYDT --skill authentication-proxy-rkaaaa404
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: authentication-proxy
Source: https://github.com/Rkaaaa404/cyberhack-SYDT/tree/main/.agents/skills/authentication-proxy
Command: npx skills add https://github.com/Rkaaaa404/cyberhack-SYDT --skill authentication-proxy-rkaaaa404

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Browser-to-backend calls in DaaS applications fail with CORS errors and missing session cookies when client components call Supabase Auth or the DaaS backend directly. This Skill enforces a same-origin proxy architecture so authentication and data requests work reliably. ## Core Features & Use Cases - Proxy Route Enforcement: Mandates that all login, logout, user lookup, and data API calls go through Next.js API routes like /api/auth/login and /api/items/* instead of direct cross-origin calls. - Correct Auth Patterns: Provides copy-ready code for login, logout, protected layouts, and server-side JWT forwarding via the getAuthHeaders helper. - External OAuth Support: Documents SSO flows for Azure AD, Okta, Auth0, and Google through /api/auth/oauth/[provider] routes. - Use Case: When building a login page for a Buildpad-generated app, use this Skill to implement the fetch call to /api/auth/login with credentials included, avoiding the common mistake of calling supabase.auth.signInWithPassword directly from the browser. ## Quick Start Ask the AI to implement a login page that authenticates through the /api/auth/login proxy route instead of calling Supabase directly from the client.

Frequently Asked Questions about authentication-proxy

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

FAQPage Schema
How do I implement login in a Next.js app with Supabase without CORS errors?▼

Send a POST request to the same-origin /api/auth/login route with email and password in the JSON body and credentials set to include. The proxy route calls supabase.auth.signInWithPassword server-side and sets the session cookie, avoiding cross-origin issues.

Why does calling Supabase auth directly from the browser fail?▼

Direct browser calls to Supabase or the DaaS backend trigger CORS preflight checks and cookie restrictions because they run on different ports or domains. The session cookie also may not be set correctly for the proxy routes, breaking subsequent authenticated requests.

How do I forward the user JWT to a DaaS backend in API routes?▼

Import the getAuthHeaders helper from @/lib/api/auth-headers inside your API route and pass the returned headers to the fetch call targeting the DaaS backend URL. This forwards the user's JWT server-side without exposing tokens to the browser.

Why do I get a 403 FORBIDDEN_SCOPE error after a different user logs in?▼

The daas_resource_uri cookie persists after logout and forwards the previous user's scope URI as X-Resource-Uri. Fix it by deleting that cookie in the logout route and validating the stored URI against the user's available scopes in ScopeContext.

Can I use Supabase signInWithOAuth for external SSO providers?▼

No, Supabase's signInWithOAuth is not configured for self-hosted setups in this architecture. Instead, redirect the browser to /api/auth/oauth/[provider], where Next.js acts as the OAuth client and sets the session via supabase.auth.setSession.