Skip to main content

Setting up ory identity

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 (or self-hosted Ory installation)
  2. Your Ory project slug or API URL
  3. Your development environment set up with your framework of choice

1. Install SDK for your framework

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

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

# Verify installation
ory help

Start Ory Tunnel

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

# Start the tunnel (replace with your project slug)
ory tunnel --dev https://$PROJECT_SLUG.projects.oryapis.com --port 4000
To learn more about the Ory Tunnel, read the

dedicated section of the Ory CLI documentation. :::

3. Configure the SDK

With Ory Tunnel (Local Development)

When using the tunnel, configure your SDK to use the local tunnel URL:

// For local development with tunnel
const ory = new FrontendApi(
new Configuration({
basePath: "http://localhost:4000",
credentials: "include",
}),
)

With Ory Network (Production)

Next, configure the SDK with your Ory project URL:

const { Configuration, FrontendApi } = require("@ory/client-fetch")

// Initialize the SDK
const ory = new FrontendApi(
new Configuration({
basePath: "https://$PROJECT_SLUG.projects.oryapis.com",
credentials: "include",
}),
)

Next steps

Now that you have set up the Ory SDK and verified the connection, you're ready to implement authentication flows in your application.

In the next section, we'll cover how to implement registration and login flows using browser-based authentication.