Arcjet Rate Limit / Clerk Authentication Example
++ These two API routes are both protected with an Arcjet rate limit: +
+-
+
-
+
+
/api/public
+ {" "} + does not require authentication and has a low rate limit based on + the user IP address. +
+ -
+
+
/api/private
+ {" "} + uses Clerk authentication and has a higher rate limit based on the + Clerk user ID. +
+
Testing the private endpoint
+-
+
-
+ Visit{" "}
+
+
/api/token
+ {" "} + and then log in to Clerk. +
+ -
+ You will be redirected back to the
/api/token
page + with a token output on the page. +
+ -
+ Visit{" "}
+
+
/api/private
+ {" "} + in your browser or use the token to send severalcurl
{" "} + requests to/api/private
+
+
+ curl -v http://localhost:3000/api/private -H "Authorization: Bearer + TOKENHERE" ++