authenticateRequest()
Authenticates a token passed from the frontend. Networkless if the secretKey
or jwtKey
are provided. Otherwise, performs a network call to retrieve the JWKS from Clerk's Backend API.
- Name
request
- Type
Request
- Description
req
object
- Name
secretKey?
- Type
string
- Description
The Clerk secret key from the API Keys page in the Clerk Dashboard.
- Name
publishableKey?
- Type
string
- Description
The Clerk publishable key from the API Keys page in the Clerk Dashboard.
- Name
domain?
- Type
string
- Description
The domain for the application. For development, you can pass the localhost your application is running on. For example:
localhost:3001
- Name
isSatellite?
- Type
boolean
- Description
Set to
true
if the instance is a satellite domain in a multi-domain setup.
- Name
proxyUrl?
- Type
string
- Description
The proxy URL from a multi-domain setup.
- Name
signInUrl?
- Type
string
- Description
The sign-in URL from a multi-domain setup.
- Name
jwtKey?
- Type
string
- Description
The PEM public key from the API Keys page -> Advanced -> JWT public key section of the Clerk Dashboard.
- Name
audience?
- Type
string | string[]
- Description
A string or list of audiences.
- Name
frontendApi?
- Type
string
- Description
The Clerk publishable key (deprecated in favor of
publishableKey
)
- Name
apiKey?
- Type
string
- Description
The Clerk API key (deprecated in favor of
secretKey
)
Examples
authenticateRequest({ req })
Takes the token passed by the frontend as a Bearer token in the Authorization header, and performs a networkless authenication. This will verify if the user is signed into the application or not.
Feedback
Last updated on