Clerk logo

Clerk Docs

Ctrl + K
Go to

API Routes

The getAuth() helper retrieves the authentication state allowing you to protect your API routes or gather relevant data.


Before Next.js 12.2

You can use withAuth to retrieve data and use requireAuth to protect your route automatically while retrieveing data.


Example Response

More detailed information about the fields in this object can be found in the Authentication Object documentation.

Was this helpful?

Clerk © 2022