Skip to main content

Installation

Install the required dependencies:

Configuration

  1. Get your Rownd App Key:
    • Sign up or log in at Rownd Dashboard
    • Create/select your application
    • Copy your App Key (e.g., key_xxxxxxxx)
    • Copy your App ID This is used to verify the audience.
  2. Set up Convex:

RowndProvider Setup

Wrap your app with RowndProvider from @rownd/react/convex and pass both your Convex client and Rownd app key:

Server-side Usage

Add Rownd to your auth.config.js file.

Add these to your convex/auth.config.js file:
[! NOTE] Ensure you have the app: in addition to your app-id. For example, applicationID: “app:app_alksdjflakjvlkeja”

Mapping Rownd IDs in Convex

It is critical to keep a mapping of the Rownd user ID in your Convex users table.
This allows you to associate Rownd-authenticated users with your app’s data.
Schema example:
Storing and looking up users by Rownd ID: This example mutation ensures the existence of a user record in your database for the currently authenticated user. ctx.auth.getUserIdentity() will return all of the claim data included in the user’s JWT. You can use the subject value to map your internal users to Rownd user’s.

Accessing the Current User

To get the current authenticated user in any Convex function, always look up by the Rownd ID:

Protecting Convex Functions

Always check for authentication and use the Rownd ID mapping to associate data with users:

Client-side Usage

Using Rownd React SDK Features

After setting up the RowndProvider, you can use all other features of the @rownd/react SDK in your app as documented in the official Rownd docs.
The Rownd React SDK only handles client-side authentication state. For proper integration with Convex, you should use Convex’s authentication hooks and utilities to ensure server-side state is properly synchronized.
Create a custom hook like useStoreUserEffect to handle the authentication flow as outlined in these Convex docs Example:
For more details and advanced usage, see the Rownd React SDK documentation.

Best Practices & Tips

  • Always map Rownd IDs:
    Store the Rownd user ID (identity.subject) in your users table and use it as the primary lookup for all user-specific data.
  • Use indexes for efficient lookups:
    Index your users table by rowndId for fast queries.
  • Optionally include additional profile data in JWT claims You can use the Rownd Platform to setup profile data fields for inclusion in additional JWT claims. This makes them avaiable on the ctx.auth.getUserIdentity()