MCPcopy Index your code
hub / github.com/descope-sample-apps/descope-convex

github.com/descope-sample-apps/descope-convex @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
51 symbols 281 edges 78 files 0 documented · 0% updated 2y ago★ 33
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

image

Descope Convex Sample App 🚀

This sample app showcases how to implement authentication in your Convex application using Descope.

Deploy with Vercel

Under the Hood 🧐

Here's what happens when a user interacts with the authentication flow:

  1. The user clicks a Login button.
  2. They are redirected to a page where they log in via the method configured in Descope.
  3. After successful login, Descope redirects back to the original page.
  4. Descope's AuthProvider now recognizes the user as authenticated.
  5. ConvexProviderWithDescope fetches an auth token from Descope.
  6. ConvexReactClient passes this token down to your Convex backend to validate.
  7. Your Convex backend validates the token with Descope to ensure its validity.
  8. ConvexProviderWithDescope manages token refetching as needed to maintain user authentication with your backend.

Overview of the Application 🌟

Upon landing, users encounter a Log in button. Once authenticated:

  • Users' numbers in their database persist to a numbers table.
  • Generating and adding a new number appends it to the list via a Convex mutation.
  • A "Log Out" button allows users to end their session.

Setting up the App 💿

Setting up the app involves a few additional steps due to the authentication feature:

  1. Copy over the .env.local.example to a .env.local file with your specific values:
CONVEX_DEPLOYMENT=dev:<Your Convex Project>
NEXT_PUBLIC_CONVEX_URL= <Your Convex URL>
NEXT_PUBLIC_DESCOPE_PROJECT_ID="<Your Descope Project ID>"
NEXT_PUBLIC_ISSUER_URL="<Your Issuer URL>"

NEXT_PUBLIC_ISSUER_URL: can be found in your Descope Console under the Applications page and editing the active application

  1. Launch the app. You'll encounter an error message containing a link directing you to your Convex dashboard to configure your environment variables. Complete this setup and configure the NEXT_PUBLIC_DESCOPE_PROJECT_ID in Convex as well.

Convex Dashboard

  1. In your Descope Project Settings, ensure Generate AWS API Gateway Compliant JWT is enabled. This adjusts the Issuer URL in the OIDC token to align with Convex specifications.

Descope Project Settings

  1. Navigate to the project directory and install the necessary dependencies:
yarn install

After these steps, you're set to sign in and explore the application!

Running the App 🏃‍♂️

Once you've configured your app, you're ready to run it:

yarn dev

This command starts the Next.js development server, making your app accessible at http://localhost:3000.

Support :raised_hands:

If you encounter any issues or have questions, consult the Grafbase and Descope documentation, or reach out to our support for assistance.

Contributing 🤝

Contributions are welcome! Please feel free to submit a pull request or open an issue if you have suggestions or improvements.

License 📄

This sample app is open-source and available under the MIT License. See the LICENSE file for more details.

Extension points exported contracts — how you extend this code

CommandDialogProps (Interface)
(no doc)
components/ui/command.tsx
TextareaProps (Interface)
(no doc)
components/ui/textarea.tsx
InputProps (Interface)
(no doc)
components/ui/input.tsx
State (Interface)
(no doc)
components/ui/use-toast.ts
SheetContentProps (Interface)
(no doc)
components/ui/sheet.tsx

Core symbols most depended-on inside this repo

cn
called by 134
lib/utils.tsx
dispatch
called by 5
components/ui/use-toast.ts
se
called by 5
lib/utils.tsx
useFormField
called by 4
components/ui/form.tsx
fr
called by 4
lib/utils.tsx
addToRemoveQueue
called by 2
components/ui/use-toast.ts
genId
called by 1
components/ui/use-toast.ts
reducer
called by 1
components/ui/use-toast.ts

Shape

Function 44
Interface 7

Languages

TypeScript100%

Modules by API surface

components/ui/use-toast.ts9 symbols
lib/utils.tsx3 symbols
components/ui/sheet.tsx3 symbols
components/ui/command.tsx3 symbols
components/ui/form.tsx2 symbols
components/ui/dialog.tsx2 symbols
components/ui/badge.tsx2 symbols
components/ui/alert-dialog.tsx2 symbols
components/ui/toaster.tsx1 symbols
components/ui/textarea.tsx1 symbols
components/ui/skeleton.tsx1 symbols
components/ui/menubar.tsx1 symbols

For agents

$ claude mcp add descope-convex \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page