@whop-apps/auth v0.0.1-canary.60
Auth Docs
The auth
package exports one main function: validateToken
validateToken
The validateToken function is will take in a string / request or headers object and validate the user auth JWT set by the cloudflare app proxy.
This function ensures that the token included in the request is from a legitimate user. This user's userId is returned in the response.
If the dontThrow
parameter is specified the function is guaranteed to not throw errors and will instead return null
if the token is invalid.
It depends on the @whop-apps/core
package to get the public key and app id from the env.
Required env variables:
WHOP_JWT_PK
- the public key to verify JWT. encoded as a JWKNEXT_PUBLIC_WHOP_APP_ID
- the id of the current app.
You can also override both of these in the function arguments
Errors
all errors thrown by this package are instances of AuthError
which extends Error
and has the following properties:
code
- the error code (a more machine readable / parse-able version of the error)
9 days ago
24 days ago
25 days ago
25 days ago
26 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago