Skip to main content

Configure Ory

This guide shows how to set up the necessary dependencies and configurations to integrate Ory's identity management features into your application.

Prerequisites

Before starting, ensure you have:

  1. An Ory network account
  2. Your Ory project id
  3. Your development environment set up with your framework of choice

First, install the Ory SDK for your framework:

npm install @ory/client-fetch --save

2. Set up local development with Ory Tunnel

For local development, you'll need to use Ory Tunnel to connect your local application with Ory's APIs:

# Install Ory CLI using Homebrew
brew install ory/tap/cli

# Verify installation
ory help

After installing the CLI, start the tunnel to connect your local application with Ory's APIs:

# Start the tunnel (replace with your project id)
ory tunnel --project $PROJECT_ID http://localhost:3000
tip

To learn more about the Ory Tunnel, read the dedicated section of the Ory CLI documentation.

3. Configure the SDK

Configure your SDK to use the URL:

import { Configuration, FrontendApi } from "@ory/client-fetch"

const baseUrl = process.env.ORY_SDK_URL || "http://localhost:4000"
const ory = new sdk.FrontendApi(
new sdk.Configuration({
basePath: baseUrl,
}),
)

For local development, set the ORY_SDK_URL environment variable to the local tunnel URL:

export ORY_SDK_URL=http://localhost:4000

For production environments, set the ORY_SDK_URL environment variable to the production URL:

export ORY_SDK_URL=https://$PROJECT_SLUG.projects.ory.sh