Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

Authentication object

Both auth() and getAuth() return an Authentication object. This JavaScript object contains important information like session data, your user's ID, as well as their active organization ID.

Properties

NameDescription
actorHolds identifier for the user that is impersonating the current user.
debugUsed to help debug issues when using Clerk in development.
getTokenA function that returns a promise that resolves to the current user's session token. Can also be used to retrieve a custom JWT template.
hasA function that returns a boolean based on the permission or role provided as parameter. Can be used for authorization.
orgIdThe current user's active organization ID.
orgRoleThe current user's active organization role.
orgPermissionsThe current user's active organization permissions.
orgSlugThe current user's active organization slug.
organizationThe current user's active organization object.
sessionClaimThe current user's session claim.
sessionIdThe current user's session ID.
userIdThe current user's unique identifier.

Example

{ sessionId: 'sess_2GaMqUCB3Sc1WNAkWuNzsnYVVEy', userId: 'user_2F2u1wtUyUlxKgFkKqtJNtpJJWj', orgId: null, orgRole: null, orgSlug: null, orgPermissions: null, has: [Function (anonymous)], getToken: [AsyncFunction (anonymous)], claims: { azp: 'http://localhost:3000', exp: 1666622607, iat: 1666622547, iss: 'https://clerk.quiet.muskox-85.lcl.dev', nbf: 1666622537, sid: 'sess_2GaMqUCB3Sc1WNAkWuNzsnYVVEy', sub: 'user_2F2u1wtUyUlxKgFkKqtJNtpJJWj' } }

Example with active organization

{ sessionId: 'sess_2GaMqUCB3Sc1WNAkWuNzsnYVVEy', userId: 'user_2F2u1wtUyUlxKgFkKqtJNtpJJWj', orgId: 'org_2ZVFfVAkt4ocVjHL0KTdL94AhXK', orgRole: 'org:admin', orgSlug: undefined, orgPermissions: ['org:team_settings:manage'], // Custom permissions has: [Function (anonymous)], getToken: [AsyncFunction (anonymous)], claims: { azp: 'http://localhost:3000', exp: 1666622607, iat: 1666622547, iss: 'https://clerk.quiet.muskox-85.lcl.dev', nbf: 1666622537, sid: 'sess_2GaMqUCB3Sc1WNAkWuNzsnYVVEy', sub: 'user_2F2u1wtUyUlxKgFkKqtJNtpJJWj' } }

What did you think of this content?

Clerk © 2024