-
Notifications
You must be signed in to change notification settings - Fork 0
Add Privy authentication to website example #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| "use client"; | ||
| import { PrivyProvider } from "@privy-io/react-auth"; | ||
|
|
||
| export default function Providers({ children }: { children: React.ReactNode }) { | ||
| return ( | ||
| <PrivyProvider | ||
| appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID!} | ||
| config={{ | ||
| loginMethods: ["email"], | ||
| }} | ||
| > | ||
| {children} | ||
| </PrivyProvider> | ||
| ); | ||
|
Comment on lines
+4
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing env var will silently pass The non-null assertion ( Proposed fix+const PRIVY_APP_ID = process.env.NEXT_PUBLIC_PRIVY_APP_ID;
+if (!PRIVY_APP_ID) {
+ throw new Error("NEXT_PUBLIC_PRIVY_APP_ID environment variable is required");
+}
+
export default function Providers({ children }: { children: React.ReactNode }) {
return (
- <PrivyProvider appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID!}>
+ <PrivyProvider appId={PRIVY_APP_ID}>
{children}
</PrivyProvider>
);
}🤖 Prompt for AI Agents |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: Recoupable-com/Recoup-Bash
Length of output: 146
🏁 Script executed:
cat -n examples/website/app/api/agent/route.ts | head -100Repository: Recoupable-com/Recoup-Bash
Length of output: 4183
🌐 Web query:
Privy@privy-io/server-authverifyAuthToken API💡 Result:
In
@privy-io/server-auth, you verify a Privy access token (JWT) with:authToken: string(the user’s access token, typically fromAuthorization: Bearer <token>). [1]appId,userId(user’s Privy DID),issuer(alwaysprivy.io),issuedAt,expiration,sessionId. [1]jwtVerificationKeycopied from the Privy Dashboard. [1]Notes:
@privy-io/server-authis deprecated; Privy recommends@privy-io/nodefor new work, but the token-verification flow is the same conceptually. [2]Sources: Privy token verification guide (includes
verifyAuthTokenexample + return fields) [1]; Privy@privy-io/server-authdeprecation note [2].Bearer token is never verified server-side — any arbitrary string bypasses this check.
The route only checks that an
Authorizationheader starting with"Bearer "exists, but never validates the token itself. Any caller can sendAuthorization: Bearer fakeand access the endpoint. Privy's@privy-io/server-authprovidesverifyAuthToken(token)to validate the token server-side and extract claims; without it, this auth gate provides no real protection.🤖 Prompt for AI Agents