Initial commit
This commit is contained in:
23
templates/jwt/advanced-template.json
Normal file
23
templates/jwt/advanced-template.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$comment": "Advanced Clerk JWT Template - Multi-Tenant with Fallbacks",
|
||||
"$description": "This template demonstrates advanced features: string interpolation, conditional expressions, nested metadata access, and organization claims. Copy this JSON (without $ prefixed fields) into Clerk Dashboard.",
|
||||
|
||||
"user_id": "{{user.id}}",
|
||||
"email": "{{user.primary_email_address}}",
|
||||
"full_name": "{{user.last_name}} {{user.first_name}}",
|
||||
"avatar": "{{user.image_url}}",
|
||||
|
||||
"role": "{{user.public_metadata.role || 'user'}}",
|
||||
"department": "{{user.public_metadata.department || 'general'}}",
|
||||
"permissions": "{{user.public_metadata.permissions}}",
|
||||
|
||||
"org_id": "{{user.public_metadata.org_id}}",
|
||||
"org_slug": "{{user.public_metadata.org_slug}}",
|
||||
"org_role": "{{user.public_metadata.org_role}}",
|
||||
|
||||
"interests": "{{user.public_metadata.profile.interests}}",
|
||||
"has_verified_contact": "{{user.email_verified || user.phone_number_verified}}",
|
||||
|
||||
"age": "{{user.public_metadata.age || user.unsafe_metadata.age || 18}}",
|
||||
"onboarding_complete": "{{user.public_metadata.onboardingComplete || false}}"
|
||||
}
|
||||
8
templates/jwt/basic-template.json
Normal file
8
templates/jwt/basic-template.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$comment": "Basic Clerk JWT Template - Role-Based Access Control",
|
||||
"$description": "This template includes minimal user information for role-based authentication. Copy this JSON (without comments) into Clerk Dashboard > Sessions > Customize session token > Create template.",
|
||||
|
||||
"user_id": "{{user.id}}",
|
||||
"email": "{{user.primary_email_address}}",
|
||||
"role": "{{user.public_metadata.role || 'user'}}"
|
||||
}
|
||||
14
templates/jwt/grafbase-template.json
Normal file
14
templates/jwt/grafbase-template.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"$comment": "Grafbase GraphQL Integration JWT Template",
|
||||
"$description": "This template is for Grafbase integration with role-based access control. Grafbase uses 'groups' array for authorization. Name it 'grafbase' in Clerk Dashboard.",
|
||||
"$usage": "const token = await getToken({ template: 'grafbase' }); // Use in GraphQL requests",
|
||||
"$grafbase_config": "In grafbase.toml: [auth.providers.clerk] issuer = 'https://your-app.clerk.accounts.dev' jwks = 'https://your-app.clerk.accounts.dev/.well-known/jwks.json'",
|
||||
|
||||
"sub": "{{user.id}}",
|
||||
"groups": [
|
||||
"org:{{user.public_metadata.org_role || 'member'}}",
|
||||
"user:authenticated"
|
||||
],
|
||||
"email": "{{user.primary_email_address}}",
|
||||
"name": "{{user.full_name || user.first_name}}"
|
||||
}
|
||||
17
templates/jwt/supabase-template.json
Normal file
17
templates/jwt/supabase-template.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$comment": "Supabase Integration JWT Template",
|
||||
"$description": "This template is designed for Supabase integration. Name it 'supabase' in Clerk Dashboard. Use with getToken({ template: 'supabase' }) to authenticate Supabase client.",
|
||||
"$usage": "const token = await getToken({ template: 'supabase' }); const supabase = createClient(url, key, { global: { headers: { Authorization: `Bearer ${token}` } } });",
|
||||
|
||||
"aud": "authenticated",
|
||||
"email": "{{user.primary_email_address}}",
|
||||
"app_metadata": {
|
||||
"provider": "clerk",
|
||||
"providers": ["clerk"]
|
||||
},
|
||||
"user_metadata": {
|
||||
"full_name": "{{user.full_name || user.first_name || 'User'}}",
|
||||
"avatar_url": "{{user.image_url}}",
|
||||
"email": "{{user.primary_email_address}}"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user