AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Add Login

skill-sso-ss-vibe-ship-it-add-login · by sso-ss

Adds user authentication. Triggers: 'login', 'log in', 'sign in', 'sign up', 'register', 'authentication', 'auth', 'only I can see', 'protect this page', 'private page', 'admin area', 'user accounts', 'members only', 'password protect'.

No reviews yet
0 installs
30 views
0.0% view→install

Install

$ agentstack add skill-sso-ss-vibe-ship-it-add-login

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-sso-ss-vibe-ship-it-add-login)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
5mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Add Login? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Add Login

Adds user authentication so some pages are public and others require signing in.

The Bouncer Analogy

> "Think of it like a bouncer at a door. Your landing page and portfolio are open to everyone. But the dashboard where you see bookings? That's behind a door with a bouncer — only you get in."

Default: Supabase Auth

For the web stack (Next.js + Supabase), use Supabase Auth since Supabase is already in the project for data storage.

Step 1: Create Login Page

Create src/app/login/page.tsx:

'use client'

import { createClient } from '@/utils/supabase/client'
import { useState } from 'react'
import { useRouter } from 'next/navigation'

export default function LoginPage() {
  const [email, setEmail] = useState('')
  const [password, setPassword] = useState('')
  const [error, setError] = useState('')
  const [loading, setLoading] = useState(false)
  const router = useRouter()

  async function handleLogin(e: React.FormEvent) {
    e.preventDefault()
    setLoading(true)
    setError('')

    const supabase = createClient()
    const { error } = await supabase.auth.signInWithPassword({
      email,
      password,
    })

    if (error) {
      setError('Wrong email or password. Try again.')
      setLoading(false)
    } else {
      router.push('/dashboard')
    }
  }

  return (
    
      
        Sign in
        {error && {error}}
         setEmail(e.target.value)}
          className="w-full px-4 py-2 border rounded-lg"
          required
        />
         setPassword(e.target.value)}
          className="w-full px-4 py-2 border rounded-lg"
          required
        />
        
          {loading ? 'Signing in...' : 'Sign in'}
        
      
    
  )
}

Step 2: Create Browser Supabase Client

If not already present, create src/utils/supabase/client.ts:

import { createBrowserClient } from '@supabase/ssr'

export function createClient() {
  return createBrowserClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
  )
}

Step 3: Protect Pages with Middleware

Create src/middleware.ts:

import { createServerClient } from '@supabase/ssr'
import { NextResponse, type NextRequest } from 'next/server'

export async function middleware(request: NextRequest) {
  let response = NextResponse.next({ request })
  
  const supabase = createServerClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
    {
      cookies: {
        getAll() { return request.cookies.getAll() },
        setAll(cookiesToSet) {
          cookiesToSet.forEach(({ name, value, options }) => {
            response.cookies.set(name, value, options)
          })
        },
      },
    }
  )

  const { data: { user } } = await supabase.auth.getUser()

  // Not logged in and trying to access protected route
  if (!user && request.nextUrl.pathname.startsWith('/dashboard')) {
    return NextResponse.redirect(new URL('/login', request.url))
  }

  // Already logged in and on login page
  if (user && request.nextUrl.pathname === '/login') {
    return NextResponse.redirect(new URL('/dashboard', request.url))
  }

  return response
}

export const config = {
  matcher: ['/dashboard/:path*', '/login'],
}

Step 4: Create First User

> "Go to your Supabase dashboard → Authentication → Users → Add User. Enter your email and a password. That's your login for the admin area."

Step 5: Add Sign Out

Add a sign out button wherever the designer's admin area is:

 {
  const supabase = createClient()
  await supabase.auth.signOut()
  window.location.href = '/'
}}>
  Sign out

Step 6: Test It

> "Try these: > 1. Go to /dashboard — it should redirect you to /login > 2. Sign in with the email and password you created > 3. You should land on /dashboard > 4. Sign out — you should be back on the home page"

What Gets Protected

The middleware matcher controls which pages need login. Update it based on what the designer wants protected:

// Protect only /dashboard
matcher: ['/dashboard/:path*', '/login']

// Protect everything under /admin
matcher: ['/admin/:path*', '/login']

// Protect multiple sections
matcher: ['/dashboard/:path*', '/admin/:path*', '/settings/:path*', '/login']

Common Issues

| Problem | Fix | |---|---| | Login works but redirects to wrong page | Check the router.push() URL in login page | | "Auth session missing" | Check middleware is refreshing the session properly | | Can't create user | Check Supabase Auth settings — email provider must be enabled | | Redirect loop on /login | Check middleware — it might be protecting /login itself | | After deploy, login breaks | Environment variables must be set on Vercel/deploy platform too |

Future: Other Auth Options

If the designer needs more (social login, magic links, multi-tenant):

  • Clerk — more UI components out of the box, better for complex auth
  • NextAuth/Auth.js — more flexible, more setup
  • Supabase Magic Link — passwordless (email a login link)

Don't suggest these unless the basic Supabase Auth is insufficient.

After Adding Login

Update the Stack section in PROJECT.md to reflect that auth is set up, and note which pages are protected. Create PROJECT.md if it doesn't exist.

Platform-Specific

Mobile (Expo)

  • Use Supabase Auth with expo-auth-session for OAuth, or email/password directly
  • Store session tokens in expo-secure-store (see mobile-expo platform pack)
  • Protect screens by checking supabase.auth.getSession() in a layout or wrapper
  • No middleware — use a React context or hook to gate screens
  • Example:

``tsx const { data: { session } } = await supabase.auth.getSession() if (!session) router.replace('/login') ``

Figma Plugin

  • Not needed — Figma handles user identity automatically
  • If the designer says "only I can use this plugin," explain that Figma controls access through plugin publishing settings (private vs public)
  • For per-user preferences, use figma.clientStorage

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.