Clerk Ruby SDK
Create a Clerk application
You need to create a Clerk application in your Clerk Dashboard before you can set up Clerk Ruby. For more information, check out our Set up your application 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. Go to the Clerk Dashboard and 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:
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.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