-
Notifications
You must be signed in to change notification settings - Fork 869
Add SDK-specificity to Authentication flows, User management, and Session management sections #2595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
190 commits
Select commit
Hold shift + click to select a range
4fd7d1b
bring in kyles scripts
NWylynko 28f40e2
support top level and nested items
NWylynko b62ccef
add watch script
NWylynko edeef17
Add mapping generation to build ci
NWylynko f288985
run migration map checker in gh action
NWylynko 4349075
flip order
NWylynko c3d5cc2
run on push to test ci
NWylynko 7da6b58
generate the manifest first
NWylynko d41ab9f
remove watch from tsx cli
NWylynko be7e558
define flags in this repo instead of clerk/clerk
NWylynko e8fb05c
Only enable ci on certain file changes
NWylynko b22f559
disable feature flags
NWylynko c32a424
fix up tests
NWylynko 7c8f48b
Potential fix for code scanning alert no. 10: Workflow does not conta…
NWylynko b919b0f
add support for 3rd level dropdown
NWylynko 794d218
Add a readme for new scripts
NWylynko 8797e04
Add dotenv
NWylynko 6d75db8
activate top-level manifest splitting and proposal generation
kylemac 2db149f
add support for icons in proposal.md. add more to proposal
kylemac 15b54b6
revise proposal
kylemac e832559
proposal checkpoint
kylemac 580f0d0
proposal checkpoint
kylemac d1c0c09
add sub top-level categories under reference
kylemac 5e5ef6e
update proposal from content tuple
kylemac a33d50d
progress checkin: mostly mappings
kylemac fe30e22
triage webhooks section
kylemac 7d67070
update
alexisintech cc98875
work on the mapping script
NWylynko 7a87a82
Add --fix arg
NWylynko 541bf8a
Add script for much better doc deletion
NWylynko 42d6bcb
wip
NWylynko b71d39e
don't report handled tasks as unhandled files
NWylynko 96ccc3f
Filter out redundant move tasks where source and destination paths ar…
NWylynko f8f506a
doc needs consonidation
NWylynko bf0026e
consolidate
NWylynko 9377180
Merge branch 'main' into ia/docs-team-proposal
NWylynko c434319
add delete doc script to package.json
alexisintech 5827704
update proposal.md
alexisintech bd05a97
add hooks to general reference in proposal.md
alexisintech 7ae4daf
Added functionality to identify pages needing creation based on the p…
NWylynko 2f5f2e9
Merge branch 'ia/docs-team-proposal' of github.com:clerk/clerk-docs i…
NWylynko c3348ad
Remove --fix arg from script
NWylynko 7e05441
Remove temporary fix for files in map-content.ts
NWylynko d231049
manual fixes
alexisintech 4f48151
update delete-doc script to update links for a deleted path
alexisintech 0ab77c3
Merge branch 'main' into ia/docs-team-proposal
alexisintech 3f0ec0e
add use-migration-blank-page flag
alexisintech 1bda73f
Add support for arbitrary json in proposal.md
NWylynko 500b336
Add {"collapse": false} to overright default collapse true
NWylynko 87c788b
fix up headings
NWylynko 9bbb93f
add tag as an expected type
alexisintech 51c86a7
Merge branch 'main' into ia/docs-team-proposal
alexisintech 3d00b81
Merge branch 'main' into ia/docs-team-proposal
alexisintech c103b38
IA: Configuring your app (/configure) section (#2453)
alexisintech a8bd645
fix broken link
alexisintech 9400d54
collapsible headings shouldnt be included in path/href generation
alexisintech e3eeb89
fix social connections all providers subheading
alexisintech 74e96bf
docs review minor changes
SarahSoutoul d0549f6
revert 9400d54
alexisintech e829efa
/configure updates
alexisintech eac33c7
IA: Customizing Clerk (/customizing-clerk) section (#2454)
alexisintech 18b1898
IA: Users (/users) section (#2455)
alexisintech 4fcfe36
Remove generated manifest validation
NWylynko 3b3a8d5
IA: Securing your app and How Clerk works sections (#2458)
alexisintech bbbb565
Add watcher for flags.json file changes
NWylynko b90d128
IA: Hooks and components (#2464)
alexisintech 825a0d7
Merge branch 'main' into ia/docs-team-proposal
alexisintech 698e41b
Fix unhandled files on proposal-mapping
SarahSoutoul f87faa4
Add option {"skip": true} to skip a segment from href generation
NWylynko bd7dfe2
IA: Development (/development) section (#2463)
alexisintech 6aec942
IA: B2B Organizations, Billing, Dashboard sections (#2457)
alexisintech 62a34cd
fix redirects
alexisintech e0823a6
Merge branch 'main' into ia/docs-team-proposal
alexisintech 0e9478d
fix broken link
alexisintech 96161c2
move force-mfa
alexisintech 912e4fa
Fix proposal mapping after bringing back force mfa + fix broken link
SarahSoutoul f925265
updates that got lost from main
alexisintech 3419146
IA: References (#2494)
alexisintech d9756c8
Merge branch 'main' into ia/docs-team-proposal
alexisintech 8476eb9
Switch to validating the proposal manifest
NWylynko 8995b38
Fix links in machine auth
SarahSoutoul c1740ff
Move machine auth under development
SarahSoutoul dcee2df
Switch manifest.json over to the new generated proposal manifest
NWylynko 9368799
Merge branch 'main' into ia/docs-team-proposal
SarahSoutoul 06b2d79
add remove-sdk-development flag
alexisintech e971241
Merge branch 'main' into ia/docs-team-proposal
alexisintech 209df91
Update href for "View all guides" to work with https://github.com/cle…
NWylynko 466a643
IA: Getting Started + moving SDK specific guides (#2512)
alexisintech ad2f086
handle warnings that are failing build
alexisintech 02a2fe2
Merge branch 'main' into ia/docs-team-proposal
alexisintech 82a3cdc
Merge branch 'main' into ia/docs-team-proposal
alexisintech 5e567d8
Merge branch 'main' into ia/docs-team-proposal
SarahSoutoul 9e863e6
Add support to link directly to specific sdk variant of a page
NWylynko 9509ac9
Delete guides overview page
SarahSoutoul f5b6de8
Remove the check-links linter (deprecated)
NWylynko 6856708
change session tasks name in sidebar
alexisintech f03e7a2
Change heading to user management
SarahSoutoul d9ec3f7
references --> reference
alexisintech 4eab2c2
merge 'nick/build-script-scoped-to-scoped-with-typedoc' in to 'ia/doc…
NWylynko 17677ee
Merge branch 'main' into ia/docs-team-proposal
alexisintech 3ec227a
fix lint errors
alexisintech 2e4e94f
Merge branch 'main' into ia/docs-team-proposal
alexisintech 8ab135b
Merge branch 'main' into ia/docs-team-proposal
alexisintech 02551ab
Merge branch 'main' into ia/docs-team-proposal
alexisintech 69fe2e9
add api reference overview
alexisintech 2bd1103
Merge branch 'main' into ia/docs-team-proposal
alexisintech 09e289e
update api reference overview
alexisintech cd49816
remove check-links from lint workflow
alexisintech da74a31
fix broken links
alexisintech 2f387af
add demo repos
alexisintech 528675a
IA - Add a section to Core Concepts page (#2547)
SarahSoutoul f76773a
IA: category rework proposal (#2538)
alexisintech 134b0ce
/docs/references/general/** --> /docs/references/**
alexisintech c665602
fix misspelling
alexisintech bba66e5
IA: navbar top level collapsible (#2555)
NWylynko 7bccc35
Fix typos and wrong link
SarahSoutoul cb5d620
Merge branch 'main' into ia/docs-team-proposal
alexisintech 1f248fc
add sdk specificity to doc variant links
alexisintech 509e427
Docs IA: Add 3 overview pages to bring consistency (#2572)
SarahSoutoul 04cf52c
Merge branch 'main' into ia/docs-team-proposal
SarahSoutoul d28a08c
IA - Fix link hash checking in build script (#2584)
NWylynko e72ee65
audit: fix redirects
alexisintech dfb3e9d
Merge branch 'main' into ia/docs-team-proposal
alexisintech d5e5c5b
fix links
alexisintech 2ed4340
IA: Roy feedback (#2585)
alexisintech 4c071e8
wip
alexisintech 1e2d953
update
alexisintech bb84458
Merge branch 'main' into ia/docs-team-proposal
alexisintech 775a75a
Merge branch 'ia/docs-team-proposal' into aa/sdk-specificity-project
alexisintech 3808510
update
alexisintech e4a6b8f
backend sdk --> js backend sdk
alexisintech 164631a
Merge branch 'ia/docs-team-proposal' into aa/sdk-specificity-project
alexisintech 5981b6e
backend sdk --> js backend sdk
alexisintech 2df6042
Merge branch 'ia/docs-team-proposal' into aa/sdk-specificity-project
alexisintech 65fe762
react router: replace src/ with app/
alexisintech f680ed3
Merge branch 'ia/docs-team-proposal' into aa/sdk-specificity-project
alexisintech 91bb42a
leftover backend sdk --> js backend sdk
alexisintech 27ee75d
Merge branch 'ia/docs-team-proposal' into aa/sdk-specificity-project
alexisintech e19f105
fix links
alexisintech c588a8a
Merge branch 'ia/docs-team-proposal' into aa/sdk-specificity-project
alexisintech 743c184
Only show the hooks overview for sdks that support react hooks
NWylynko 91cc63b
Docs build script - dist folder improvements (#2601)
NWylynko dcdc79f
Merge branch 'main' into ia/docs-team-proposal
alexisintech e199eb0
fix broken links
alexisintech b0273b4
misc updates based on feedback (#2600)
kylemac d7520b0
IA: Pull overview content into dedicated pages (#2606)
alexisintech 83e78ee
IA - move /docs/references to /docs/reference (#2607)
NWylynko d244404
Switch to dynamic redirects
NWylynko 92cb51a
Add dynamic redirect to handle sdk scoped guides
NWylynko 0cfe90f
Overwrite the existing dist if it exists
NWylynko f143337
Merge branch 'main' into ia/docs-team-proposal
alexisintech 2e95154
Check and remove the ignored dist folder if it exists
NWylynko 8f2178f
Fix link
NWylynko aaa05f8
Add support for dynamic redirects, Convert script to typescript, add …
NWylynko 9736376
Fix link to quickstart from backend overview
NWylynko 7c76899
consider distinct sdk variants when determining if to inject sdk in href
NWylynko 8078a42
Merge branch 'main' into ia/docs-team-proposal
alexisintech 325b157
ignore typedoc warnings
alexisintech 6e8accf
Guides overview revamp to be more visually aesthetic (#2609)
SarahSoutoul aecff1a
Remove outdated proposal manifest
NWylynko 2b94dec
Add wrap for long component name
NWylynko 536b458
Fix linting
SarahSoutoul bbde109
Merge branch 'main' into ia/docs-team-proposal
alexisintech 81eb2cb
move backend reference docs to be named references
alexisintech c67f575
ignore warnings
alexisintech 2a4798d
Merge branch 'ia/docs-team-proposal' into aa/sdk-specificity-project
alexisintech 54fef82
updates
alexisintech 560a350
Merge branch 'main' into aa/sdk-specificity-project
alexisintech 248e98c
fix supabase link
alexisintech fe0aa87
remove migration assistant
alexisintech e576e69
updates
alexisintech 25dc568
Merge branch 'main' into aa/sdk-specificity-project
alexisintech 1705d2b
updates
alexisintech 906510e
Merge branch 'main' into aa/sdk-specificity-project
alexisintech 34dc91b
update
alexisintech c56535e
update hash
alexisintech 02a7f8b
remove go examples
alexisintech d91f5d2
fix headings on session tasks guide
alexisintech 0c03196
remove ruby examples
alexisintech b7b0854
Update docs/reference/nextjs/overview.mdx
alexisintech e50e1c1
code review suggestions
alexisintech 7dc8fc3
Merge branch 'main' into aa/sdk-specificity-project
alexisintech 2e7f97e
fix method types for examples
alexisintech 2f1c963
remove getauth copy
alexisintech 7869f75
move clerkclient init outside of request
alexisintech 9d33494
remove try catch
alexisintech cec9255
docs suggestions
alexisintech 93c5bec
update comment in code example
alexisintech b3bb25b
docs suggestions
alexisintech 2e7a66a
Merge branch 'main' into aa/sdk-specificity-project
alexisintech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,165 @@ | ||
| ```tsx | ||
| import { createClerkClient } from '@clerk/backend' | ||
| <Tabs items={["Next.js", "Astro", "Express", "JS Backend SDK", "React Router", "Tanstack React Start"]}> | ||
| <Tab> | ||
| ```tsx {{ filename: 'app/api/example/route.ts' }} | ||
| import { clerkClient } from '@clerk/nextjs/server' | ||
|
|
||
| export async function GET(req: Request) { | ||
| const clerkClient = createClerkClient({ | ||
| secretKey: process.env.CLERK_SECRET_KEY, | ||
| publishableKey: process.env.CLERK_PUBLISHABLE_KEY, | ||
| }) | ||
| // Initialize the JS Backend SDK | ||
| // This varies depending on the SDK you're using | ||
| // https://clerk.com/docs/js-backend/getting-started/quickstart | ||
| const client = await clerkClient() | ||
|
|
||
| const { isSignedIn } = await clerkClient.authenticateRequest(req, { | ||
| jwtKey: process.env.CLERK_JWT_KEY, | ||
| authorizedParties: ['https://example.com'], | ||
| }) | ||
| export async function GET(req: Request) { | ||
| // Use the `authenticateRequest()` method to verify the token | ||
| const { isAuthenticated } = await client.authenticateRequest(req, { | ||
| authorizedParties: ['https://example.com'], | ||
| jwtKey: process.env.CLERK_JWT_KEY, | ||
| }) | ||
|
|
||
| if (!isSignedIn) { | ||
| return Response.json({ status: 401 }) | ||
| } | ||
| // Protect the route from unauthenticated users | ||
| if (!isAuthenticated) { | ||
| return Response.json({ status: 401 }) | ||
| } | ||
|
|
||
| // Add logic to perform protected actions | ||
| // Add logic to perform protected actions | ||
|
|
||
| return Response.json({ message: 'This is a reply' }) | ||
| } | ||
| ``` | ||
| return Response.json({ message: 'This is a reply' }) | ||
| } | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```tsx {{ filename: 'src/api/example.ts' }} | ||
| import { clerkClient } from '@clerk/astro/server' | ||
| import type { APIRoute } from 'astro' | ||
|
|
||
| export const GET: APIRoute = async (context) => { | ||
| // Use the `authenticateRequest()` method to verify the token | ||
| const { isAuthenticated } = await clerkClient(context).authenticateRequest(context.request, { | ||
| authorizedParties: ['https://example.com'], | ||
| jwtKey: process.env.CLERK_JWT_KEY, | ||
| }) | ||
|
|
||
| // Protect the route from unauthenticated users | ||
| if (!isAuthenticated) { | ||
| return Response.json({ status: 401 }) | ||
| } | ||
|
|
||
| // Add logic to perform protected actions | ||
|
|
||
| return Response.json({ message: 'This is a reply' }) | ||
| } | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```js {{ filename: 'index.js' }} | ||
| import { createClerkClient } from '@clerk/express' | ||
| import express from 'express' | ||
|
|
||
| const app = express() | ||
| const clerkClient = createClerkClient({ secretKey: process.env.CLERK_SECRET_KEY }) | ||
|
|
||
| app.get('/user', async (req, res) => { | ||
| const { isAuthenticated } = await clerkClient.authenticateRequest(req, { | ||
| authorizedParties: ['https://example.com'], | ||
| jwtKey: process.env.CLERK_JWT_KEY, | ||
| }) | ||
|
|
||
| if (!isAuthenticated) { | ||
| res.status(401).json({ error: 'User not authenticated' }) | ||
| } | ||
|
|
||
| // Add logic to perform protected actions | ||
|
|
||
| // Return the Backend User object | ||
| res.json({ message: 'This is a reply' }) | ||
| }) | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| If you are using the [JS Backend SDK](/docs/js-backend/getting-started/quickstart) on its own, you need to provide the `secretKey` and `publishableKey` to `createClerkClient()` so that it is passed to `authenticateRequest()`. You can set these values as [environment variables](/docs/guides/development/clerk-environment-variables#clerk-publishable-and-secret-keys) and then pass them to the function. | ||
|
|
||
| ```tsx | ||
| import { createClerkClient } from '@clerk/backend' | ||
|
|
||
| // Initialize the JS Backend SDK | ||
| // This varies depending on the SDK you're using | ||
| // https://clerk.com/docs/js-backend/getting-started/quickstart | ||
| const clerkClient = createClerkClient({ | ||
| secretKey: process.env.CLERK_SECRET_KEY, | ||
| publishableKey: process.env.CLERK_PUBLISHABLE_KEY, | ||
| }) | ||
|
|
||
| export async function GET(req: Request) { | ||
| // Use the `authenticateRequest()` method to verify the token | ||
| const { isAuthenticated } = await clerkClient.authenticateRequest(req, { | ||
| authorizedParties: ['https://example.com'], | ||
| jwtKey: process.env.CLERK_JWT_KEY, | ||
| }) | ||
|
|
||
| // Protect the route from unauthenticated users | ||
| if (!isAuthenticated) { | ||
| return Response.json({ status: 401 }) | ||
| } | ||
|
|
||
| // Add logic to perform protected actions | ||
|
|
||
| return Response.json({ message: 'This is a reply' }) | ||
| } | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```tsx {{ filename: 'app/routes/example.tsx' }} | ||
| import { redirect } from 'react-router' | ||
| import { clerkClient } from '@clerk/react-router/server' | ||
| import type { Route } from './+types/example' | ||
|
|
||
| export async function loader(args: Route.LoaderArgs) { | ||
| // Use the `authenticateRequest()` method to verify the token | ||
| const { isAuthenticated } = await clerkClient(args).authenticateRequest(args.request, { | ||
| authorizedParties: ['https://example.com'], | ||
| jwtKey: process.env.CLERK_JWT_KEY, | ||
| }) | ||
|
|
||
| if (!isAuthenticated) { | ||
| return redirect('/sign-in?redirect_url=' + args.request.url) | ||
| } | ||
|
|
||
| // Add logic to perform protected actions | ||
|
|
||
| return Response.json({ message: 'This is a reply' }) | ||
| } | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```tsx {{ filename: 'app/routes/api/example.tsx' }} | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
| import { clerkClient } from '@clerk/tanstack-react-start/server' | ||
|
|
||
| export const ServerRoute = createFileRoute('/api/example')({ | ||
| server: { | ||
| handlers: { | ||
| GET: async ({ request }) => { | ||
| // Use the `authenticateRequest()` method to verify the token | ||
| const { isAuthenticated } = await clerkClient().authenticateRequest(request, { | ||
| authorizedParties: ['https://example.com'], | ||
| jwtKey: process.env.CLERK_JWT_KEY, | ||
| }) | ||
|
|
||
| if (!isAuthenticated) { | ||
| return Response.json({ status: 401 }) | ||
| } | ||
|
|
||
| // Add logic to perform protected actions | ||
|
|
||
| return Response.json({ message: 'This is a reply' }) | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| ``` | ||
| </Tab> | ||
| </Tabs> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| > [!NOTE] | ||
| > Importing `clerkClient` varies based on your framework. Refer to the [JS Backend SDK overview](/docs/js-backend/getting-started/quickstart) for usage details, including guidance on [how to access the `userId` and other properties](/docs/js-backend/getting-started/quickstart#get-the-user-id-and-other-properties). | ||
| > Using `clerkClient` varies based on your framework. Refer to the [JS Backend SDK overview](/docs/js-backend/getting-started/quickstart) for usage details, including guidance on [how to access the `userId` and other properties](/docs/js-backend/getting-started/quickstart#get-the-user-id-and-other-properties). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| <Tabs items={["Next.js", "Astro", "Express", "React Router", "Tanstack React Start"]}> | ||
| <Tab> | ||
| ```ts {{ filename: 'app/api/example/route.ts' }} | ||
| import { clerkClient } from '@clerk/nextjs/server' | ||
| import { NextResponse } from 'next/server' | ||
|
|
||
| export async function POST() { | ||
| const client = await clerkClient() | ||
| const invitation = await client.invitations.createInvitation({ | ||
| emailAddress: 'invite@example.com', | ||
| redirectUrl: 'https://www.example.com/my-sign-up', | ||
| publicMetadata: { | ||
| example: 'metadata', | ||
| example_nested: { | ||
| nested: 'metadata', | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| return NextResponse.json({ message: 'Invitation created', invitation }) | ||
| } | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```tsx {{ filename: 'src/api/example.ts' }} | ||
| import type { APIRoute } from 'astro' | ||
| import { clerkClient } from '@clerk/astro/server' | ||
|
|
||
| export const POST: APIRoute = async (context) => { | ||
| await clerkClient(context).invitations.createInvitation({ | ||
| emailAddress: 'invite@example.com', | ||
| redirectUrl: 'https://www.example.com/my-sign-up', | ||
| publicMetadata: { | ||
| example: 'metadata', | ||
| example_nested: { | ||
| nested: 'metadata', | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| return new Response(JSON.stringify({ success: true }), { status: 200 }) | ||
| } | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```ts {{ filename: 'public.ts' }} | ||
| import { getAuth, clerkClient } from '@clerk/express' | ||
|
|
||
| app.post('/createUser', async (req, res) => { | ||
| await clerkClient.invitations.createInvitation({ | ||
| emailAddress: 'invite@example.com', | ||
| redirectUrl: 'https://www.example.com/my-sign-up', | ||
| publicMetadata: { | ||
| example: 'metadata', | ||
| example_nested: { | ||
| nested: 'metadata', | ||
| }, | ||
| }, | ||
| password: 'password', | ||
| }) | ||
|
|
||
| res.status(200).json({ success: true }) | ||
| }) | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```tsx {{ filename: 'app/routes/example.tsx' }} | ||
| import { clerkClient } from '@clerk/react-router/server' | ||
| import type { Route } from './+types/example' | ||
| import { json } from 'react-router-dom' | ||
|
|
||
| export async function action({ request }: Route.ActionArgs) { | ||
| const formData = await request.formData() | ||
| const emailAddress = formData.get('emailAddress') | ||
| const redirectUrl = formData.get('redirectUrl') | ||
| const publicMetadata = formData.get('publicMetadata') | ||
|
|
||
| await clerkClient.invitations.createInvitation({ | ||
| emailAddress: emailAddress, | ||
| redirectUrl: redirectUrl, | ||
| publicMetadata: publicMetadata, | ||
| }) | ||
|
|
||
| return json({ success: true }) | ||
| } | ||
| ``` | ||
| </Tab> | ||
|
|
||
| <Tab> | ||
| ```tsx {{ filename: 'app/routes/api/example.tsx' }} | ||
| import { json } from '@tanstack/react-start' | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
| import { clerkClient } from '@clerk/tanstack-react-start/server' | ||
|
|
||
| export const ServerRoute = createFileRoute('/api/example')({ | ||
| server: { | ||
| handlers: { | ||
| POST: async () => { | ||
| await clerkClient().invitations.createInvitation({ | ||
| emailAddress: 'invite@example.com', | ||
| redirectUrl: 'https://www.example.com/my-sign-up', | ||
| publicMetadata: { | ||
| example: 'metadata', | ||
| example_nested: { | ||
| nested: 'metadata', | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| return json({ success: true }) | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.