clerk_auth
Clerk modern authentication, WebAuthn, passkeys ve social auth entegrasyonu rehberi.
npxskills add vuralserhat86/antigravity-agentic-skills--skill clerk_authLoading…
Clerk modern authentication, WebAuthn, passkeys ve social auth entegrasyonu rehberi.
npxskills add vuralserhat86/antigravity-agentic-skills--skill clerk_authLoading…
Clerk modern authentication rehberi.
npm install @clerk/nextjs
import { clerkMiddleware } from '@clerk/nextjs/server';
export default clerkMiddleware();
export const config = {
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
};
// app/layout.tsx
import { ClerkProvider } from '@clerk/nextjs';
export default function Layout({ children }) {
return (
<ClerkProvider>
<html>
<body>{children}</body>
</html>
</ClerkProvider>
);
}
import {
SignInButton,
SignUpButton,
UserButton,
SignedIn,
SignedOut
} from '@clerk/nextjs';
function Header() {
return (
<header>
<SignedOut>
<SignInButton />
<SignUpButton />
</SignedOut>
<SignedIn>
<UserButton />
</SignedIn>
</header>
);
}
import { auth, currentUser } from '@clerk/nextjs/server';
export async function GET() {
const { userId } = await auth();
if (!userId) {
return new Response('Unauthorized', { status: 401 });
}
const user = await currentUser();
return Response.json({ user });
}
Clerk Auth v1.1 - Enhanced
Kaynak: Clerk Documentation
@clerk/nextjs paketi ve API Key'ler.clerkMiddleware ile ayır.ClerkProvider ile sarmala.SignedIn / SignedOut şartlı render yapısı kur.UserButton veya UserProfile bileşenini ekle.auth().userId kontrolü yap.currentUser() ile kullanıcı verisine eriş.| Aşama | Doğrulama |
|---|---|
| 1 | Middleware statik dosyaları (image, css) engellemiyor |
| 2 | Sign-out sonrası login sayfasına yönlendiriyor |
| 3 | API request'leri tokensiz atılınca 401 dönüyor |
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).