From 12d6b75e8b24d63976fc2be732a75834c42716f9 Mon Sep 17 00:00:00 2001 From: horsefacts Date: Fri, 26 Jan 2024 19:01:29 -0500 Subject: [PATCH] feat: update example apps with auth-kit@0.1.x --- examples/frontend-only/package.json | 2 +- examples/frontend-only/src/App.tsx | 11 ++++++++--- examples/frontend-only/yarn.lock | 18 +++++++++--------- examples/with-next-auth/package.json | 2 +- .../pages/api/auth/[...nextauth].ts | 1 - examples/with-next-auth/pages/index.tsx | 6 ++++-- examples/with-next-auth/yarn.lock | 18 +++++++++--------- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/examples/frontend-only/package.json b/examples/frontend-only/package.json index 6b17457..0ebc234 100644 --- a/examples/frontend-only/package.json +++ b/examples/frontend-only/package.json @@ -10,7 +10,7 @@ "preview": "vite preview" }, "dependencies": { - "@farcaster/auth-kit": "^0.0.38", + "@farcaster/auth-kit": "^0.1.4", "react": "^18.2.0", "react-dom": "^18.2.0", "viem": "^2.0.3" diff --git a/examples/frontend-only/src/App.tsx b/examples/frontend-only/src/App.tsx index 95fd7a6..ce3ba6f 100644 --- a/examples/frontend-only/src/App.tsx +++ b/examples/frontend-only/src/App.tsx @@ -23,12 +23,12 @@ function App() { This example app shows how to use{" "} Farcaster AuthKit {" "} and{" "} - + Vite . @@ -67,15 +67,20 @@ function Profile() { const profile = useProfile(); const { isAuthenticated, - profile: { fid, displayName }, + profile: { fid, displayName, custody }, } = profile; return ( <> {isAuthenticated ? ( +

Hello, {displayName}! Your FID is {fid}.

+

+ Your custody address is:

{custody}
+

+
) : (

Click the "Sign in with Farcaster" button above, then scan the QR code diff --git a/examples/frontend-only/yarn.lock b/examples/frontend-only/yarn.lock index f47a432..2cb2423 100644 --- a/examples/frontend-only/yarn.lock +++ b/examples/frontend-only/yarn.lock @@ -377,21 +377,21 @@ resolved "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== -"@farcaster/auth-client@^0.0.22": - version "0.0.22" - resolved "https://registry.npmjs.org/@farcaster/auth-client/-/auth-client-0.0.22.tgz#776899c1acebfa19020a470f43f46ac8be3da264" - integrity sha512-F2pLeFOJVHTuxpZBQH/UiCKPlh8rxQYOUDx0vrNjlPn6Zh28lTv5zbwbgOfHk1+w+jgUqWdetDvt/CEJ7s4Irg== +"@farcaster/auth-client@^0.1.0": + version "0.1.0" + resolved "https://registry.npmjs.org/@farcaster/auth-client/-/auth-client-0.1.0.tgz#3f1608ee8398bc71e8da23a898aa721b36ce78d3" + integrity sha512-hWeUDwpyNNswclL82K5wt6sA0x0UjELGhLKSZK6JYvGAE6wNR6V8o1IBhZYIGASWHHxOGoJLZ1L1xRcvS3GbUQ== dependencies: ethers "^6.9.2" neverthrow "^6.1.0" siwe "^2.1.4" -"@farcaster/auth-kit@^0.0.38": - version "0.0.38" - resolved "https://registry.npmjs.org/@farcaster/auth-kit/-/auth-kit-0.0.38.tgz#4c73d829c57833fda03fc9635503d713c67f4f62" - integrity sha512-kZr83YnYbgPaWJX7mGq+MLa6GO870zFLFs6nGPVbyt/K4ANXoWOzueo0yrnhDomkcZH+Wp/fW6IL5PDqSONyaQ== +"@farcaster/auth-kit@^0.1.2": + version "0.1.2" + resolved "https://registry.npmjs.org/@farcaster/auth-kit/-/auth-kit-0.1.2.tgz#e84d3841f4cd0821034a10d9ffecdd86deb9fab4" + integrity sha512-n7jCBELVVLjKRt9hD5+f5L/z7iZRneAD2kHCOl5d7TRkiATn/Zp6f47ElpKd5fO0seR3k+R1+TyzKUXN8CEKNQ== dependencies: - "@farcaster/auth-client" "^0.0.22" + "@farcaster/auth-client" "^0.1.0" "@vanilla-extract/css" "^1.14.0" qrcode "^1.5.3" react-remove-scroll "^2.5.7" diff --git a/examples/with-next-auth/package.json b/examples/with-next-auth/package.json index e6e3ca1..3c70296 100644 --- a/examples/with-next-auth/package.json +++ b/examples/with-next-auth/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@farcaster/auth-kit": "^0.0.38", + "@farcaster/auth-kit": "^0.1.4", "next": "14.0.4", "next-auth": "^4.24.5", "react": "^18.2.0", diff --git a/examples/with-next-auth/pages/api/auth/[...nextauth].ts b/examples/with-next-auth/pages/api/auth/[...nextauth].ts index e742fca..20b94a3 100644 --- a/examples/with-next-auth/pages/api/auth/[...nextauth].ts +++ b/examples/with-next-auth/pages/api/auth/[...nextauth].ts @@ -2,7 +2,6 @@ import NextAuth from "next-auth"; import CredentialsProvider from "next-auth/providers/credentials"; import { createAppClient, viemConnector } from "@farcaster/auth-client"; import { NextApiRequest, NextApiResponse } from "next"; -import { getCsrfToken } from "next-auth/react"; export default (req: NextApiRequest, res: NextApiResponse) => NextAuth(req, res, { diff --git a/examples/with-next-auth/pages/index.tsx b/examples/with-next-auth/pages/index.tsx index 2c4b152..435f6e9 100644 --- a/examples/with-next-auth/pages/index.tsx +++ b/examples/with-next-auth/pages/index.tsx @@ -60,6 +60,7 @@ function Content() { nonce={getNonce} onSuccess={handleSuccess} onError={() => setError(true)} + onSignOut={() => signOut() } /> {error &&

Unable to sign in at this time.
} @@ -69,12 +70,12 @@ function Content() { This example app shows how to use{" "} Farcaster AuthKit {" "} and{" "} - + NextAuth.js . @@ -116,6 +117,7 @@ function Profile() {

Signed in as {session.user?.name}