Node.js Available Methods
All resource operations are mounted as sub-APIs on the clerkClient
object. You can find the full list of available operations in the JavaScript Backend SDK documentation. To access a resource, you must first instantiate a clerkClient
instance.
Instantiate a default clerkClient
instance
If you would like to use the default instance of clerkClient
provided by the SDK, you can provide the CLERK_SECRET_KEY
as an environment variable and instantiate clerkClient
without passing configuration options.
Instantiate a custom clerkClient
instance
If you would like to customize the behavior of the SDK, you can instantiate a clerkClient
instance yourself by calling createClerkClient
and passing in options.
The example below shows how to use createClerkClient
to create a clerkClient
instance and pass a Clerk secret key instead of setting a CLERK_SECRET_KEY
environment variable.
Customizing resources
The following options are available for you to customize the behaviour of the clerkClient
object.
Option | Description | Default | Environment variable |
---|---|---|---|
secretKey | Server key for api.clerk.com . Can be found in your Clerk Dashboard on the API Keys page. | none | CLERK_SECRET_KEY |
apiVersion | API version to use | v4 | CLERK_API_VERSION |
apiUrl | For debugging | https://api.clerk.com | CLERK_API_URL |
httpOptions | HTTP client options | {} | N/A |
For every option, the resolution is as follows, in order of descending precedence:
- option passed
- environment variable (if applicable)
- default
This means that if you pass an option to the constructor, it will always take precedence over an environment variable.
Another available environment variable is CLERK_LOGGING
. You can set its value to true
to enable additional logging that may be of use when debugging an issue.
Feedback
Last updated on