Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.dev

Getting started with Ruby

The source code of the Ruby SDK is hosted here: https://github.com/clerkinc/clerk-sdk-ruby

​Add this line to your application's Gemfile

And then execute:

Or install it yourself as:

Quick Start

First, you need to get an API key for a Clerk instance.

This is done on the API Keys page.

Then you can instantiate a Clerk::SDK instance and access all Backend API endpoints. Here's a quick example:

Configuration

The SDK can be configured in three ways: environment variables, configuration singleton and constructor arguments. The priority goes like this:

  1. Constructor arguments
  2. Configuration object
  3. Environment variables

If an argument is not provided, the configuration object is looked up, which falls back to the associated environment variable. Here's an example with all supported configuration settings their environment variable equivalents:

You can customize each instance of the Clerk::SDK object by passing keyword arguments to the constructor:

Refer to the Faraday documentation for details.

Environment variables

Here's a list of all environment variables the SDK uses:

Variable name Usage
CLERK_API_BASE Overrides the default API base URL: https://api.clerk.dev/v1/
CLERK_API_KEY The API key of your instance (required)
CLERK_SIGN_IN_URL Rails view helper: clerk_sign_in_url
CLERK_SIGN_IN_UP Rails view helper: clerk_sign_up_url
CLERK_USER_PROFILE_URL Rails view helper: clerk_user_profile_url

Was this helpful?

Clerk © 2022