Integrating Google OAuth with NextAuth.js: how to get Client and Token from google login

I would like to integrate Google OAuth with NextAuth.js and have an endpoint at /api/signin/google-oauth. To successfully authenticate a user, I need to provide the following data in the request body: "email": "[[email protected]] " "entry_event_id": "string" (I already have this value) "google_client_id": "string" "google_token_id": "string" I'm unsure how to obtain the necessary "google_client_id" and "google_token_id" from Google. Could you please guide me on how to acquire these credentials? Additionally, once I have them, which approach is recommended for posting this data to the API from the client-side: using React Query or NextAuth.js callbacks? I'm new to Next.js, and any assistance would be greatly appreciated.
8 Replies
BinarySenseiii
BinarySenseiiiOP•2y ago
@vitor markis @Panda kindly guide lit bit
Panda
Panda•2y ago
Code Commerce
YouTube
Next JS Authentication - Sign In With Google (NextAuth.js)
Learn how to incorporate Next JS authentication into your Next JS application. Sign in with Google using the Next-Auth package provided for us by Vercel! Start from a blank NextJS application and set up next-auth from scratch and sign in using your google account. šŸ™ Thank you for following along and please let me know what you think in the comm...
BinarySenseiii
BinarySenseiiiOP•2y ago
BinarySenseiii
BinarySenseiiiOP•2y ago
why its showing null
deforestor
deforestor•2y ago
Did you edit the schema.prisma to accept the new field from google?
BinarySenseiii
BinarySenseiiiOP•2y ago
m not using prisma
deforestor
deforestor•2y ago
But you're using a db, right?
BinarySenseiii
BinarySenseiiiOP•2y ago
yes mongodb

Did you find this page helpful?