Clerk Ruby SDK
Create a Clerk application
You need to create a Clerk application in the Clerk Dashboard before you can set up Clerk Ruby. For more information, see the setup guide.
Install Ruby
Once a Clerk application has been created, you can install and then start using Clerk Ruby in your application.
Add this line to your application's Gemfile.
And then execute:
Or install it yourself as:
Instantiate a Clerk::SDK
instance
To access all Backend API endpoints, you need to instantiate a Clerk::SDK
instance.
You will need your Clerk Secret Key to instantiate an instance. In the Clerk Dashboard, navigate to the API keys page and copy your Secret Key.
This examples shows how to instantiate an instance of Clerk::SDK
with your Secret Key and then send your first user a welcome email.
Configuration
The SDK can be configured in three ways: environment variables, configuration singleton and constructor arguments. The priority goes like this:
- Constructor arguments
- Configuration object
- Environment variables
Constructor arguments
You can customize each instance of the Clerk::SDK
object by passing keyword arguments to the constructor:
Configuration object
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:
For more information, see Faraday's documentation.
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.com/v1/ |
CLERK_SECRET_KEY | The Secret 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 |
Feedback
Last updated on