Clerk.AuthenticationPlug (Clerk SDK v2.0.0)
Plug for authenticating requests.
Options
:session_key- the cookie name to read the session token from. Defaults to"__session".:fetch_user- whentrue, fetches the full user object from the Clerk Backend API after token verification and assigns it as:current_user. Whenfalse, builds:current_userfrom the JWT claims alone (no network request). Defaults totrue.:config- a%Clerk.Config{}for verification and API calls. Defaults toClerk.config/0. Required when running multiple Clerk tenants in an umbrella app.
Examples
# Fetches user from Clerk API on every request (default)
plug Clerk.AuthenticationPlug
# Skip the API call — use JWT claims only
plug Clerk.AuthenticationPlug, fetch_user: false
# Use an explicit Clerk config (umbrella apps)
plug Clerk.AuthenticationPlug, config: config