{"id":368461,"date":"2023-02-14T12:31:27","date_gmt":"2023-02-14T12:31:27","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=368461"},"modified":"2026-03-09T12:06:38","modified_gmt":"2026-03-09T12:06:38","slug":"how-to-implement-social-login-in-nextjs-react-using-nextauth","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/","title":{"rendered":"How to implement Social Login in Nextjs (React) using NextAuth"},"content":{"rendered":"\n<p>In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Next.js?<\/h2>\n\n\n\n<p>Next.js is a flexible&nbsp;<strong>React framework<\/strong>&nbsp;that gives you building blocks to create fast&nbsp;<strong>web applications<\/strong>.<\/p>\n\n\n\n<p>Next.js is a framework built on top of <a href=\"https:\/\/react.dev\/\">React<\/a> that makes developing production-ready, fully-optimized React apps super fast and easy. <\/p>\n\n\n\n<p>It is one of the best things to have come out of the React ecosystem, as it comes with a whole lot of power with zero config.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is NextAuth?<\/h2>\n\n\n\n<p>NextAuth.js is a completely secured authentication for implementation in <a href=\"https:\/\/nextjs.org\/\">Next.js<\/a> applications. It is a flexible authentication library designed to sync with any OAuth service.<\/p>\n\n\n\n<p>When you need to add authentication to your next.js project, NextAuth is a wonderful option. <\/p>\n\n\n\n<p>It\u2019s easy to see why, given its extensive provider support, which includes Google, Facebook, Credentials, and more. It can help you set up your authentication in minutes!<\/p>\n\n\n\n<p><strong>Let&#8217;s create NextApp.<\/strong><\/p>\n\n\n\n<p>To create the next app visit here: <a href=\"https:\/\/webkul.com\/blog\/how-to-create-next-app\/\">How to Create Next App<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set up authentication with NextAuth.js<\/h2>\n\n\n\n<p>After the installation of the next application, we\u2019re ready to learn how to authenticate a Next.js app with NextAuth.js.<\/p>\n\n\n\n<p>Now let\u2019s install the NextAuth package by running the below command.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">npm i next-auth<\/pre>\n\n\n\n<p>We\u2019re going&nbsp;to provide&nbsp;customers&nbsp;the selection&nbsp;to log in to our app&nbsp;using&nbsp;their Google, or&nbsp;Facebook<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Facebook<\/h2>\n\n\n\n<p>To use&nbsp;the&nbsp;Facebook&nbsp;login for our app,&nbsp;we are able to&nbsp;need&nbsp;a&nbsp;<a href=\"https:\/\/developers.facebook.com\/\">Facebook&nbsp;developer account<\/a>. Create an account&nbsp;after which&nbsp;create your app. For the app&nbsp;type,&nbsp;pick&nbsp;<strong>Cusumer<\/strong>.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"593\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png\" alt=\"SelectType\" class=\"wp-image-368745\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-300x148.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-250x124.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-768x380.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType.png 1533w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">App Type<\/figcaption><\/figure>\n\n\n\n<p>Click next and within the&nbsp;details&nbsp;screen,&nbsp;pick&nbsp;a&nbsp;display&nbsp;name.<\/p>\n\n\n\n<p>Once&nbsp;this is&nbsp;completed, your&nbsp;screen&nbsp;has to&nbsp;appear like&nbsp;this:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"548\" data-id=\"368746\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AfterCreateFbApp-1200x548.png\" alt=\"AfterCreateFbApp\" class=\"wp-image-368746\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AfterCreateFbApp-1200x548.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AfterCreateFbApp-300x137.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AfterCreateFbApp-250x114.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AfterCreateFbApp-768x351.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AfterCreateFbApp.png 1531w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Setup Options<\/figcaption><\/figure>\n<\/figure>\n\n\n\n<p>Click on&nbsp;<strong>Facebook Login<\/strong>&nbsp;and select&nbsp;<strong>Web<\/strong>. Now, add the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Site URL<\/strong>: Complete the URL to your development server&nbsp;<code><a href=\"http:\/\/localhost:3000\/\">http:\/\/localhost:3000\/<\/a><\/code><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"546\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AddWebUrl-1200x546.png\" alt=\"AddWebUrl\" class=\"wp-image-368747\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AddWebUrl-1200x546.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AddWebUrl-300x136.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AddWebUrl-250x114.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AddWebUrl-768x349.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/AddWebUrl.png 1530w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Web URL<\/figcaption><\/figure>\n\n\n\n<p>To get your app ID and app secret, navigate to the&nbsp;<strong>Basic<\/strong>&nbsp;section in&nbsp;<strong>Settings<\/strong> and copy them.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"547\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-1200x547.png\" alt=\"App-Creds\" class=\"wp-image-368748\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-1200x547.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-300x137.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-250x114.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-768x350.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds.png 1530w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">App I<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"547\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-1200x547.png\" alt=\"App-Creds\" class=\"wp-image-368748\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-1200x547.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-300x137.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-250x114.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds-768x350.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/App-Creds.png 1530w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">App ID and Secret<\/figcaption><\/figure>\n\n\n\n<p>Add&nbsp;<code><a href=\"http:\/\/localhost:3000\/\">http:\/\/localhost:3000\/<\/a><\/code><em>&nbsp;<\/em>in the<em>&nbsp;<\/em>App Domains<em>&nbsp;<\/em>field<em>.<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Add an environmental variable<\/strong><\/h4>\n\n\n\n<p>Next, create an\u00a0<code>.env.local<\/code>\u00a0file in your project\u2019s root directory. Next.js has inbuilt support for environment variables and\u00a0<code>.env.local<\/code>\u00a0will load those variables to\u00a0<code>process.env<\/code>. <\/p>\n\n\n\n<p>Therefore, the filename cannot be a random name. For more information, please read\u00a0<a href=\"https:\/\/nextjs.org\/docs\/basic-features\/environment-variables\" target=\"_blank\" rel=\"noreferrer noopener\">Next.js documentation on environment variables<\/a>.<\/p>\n\n\n\n<p>Next, populate it with the following content:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">FACEBOOK_ID=&lt;app id of your facebook app&gt;\nFACEBOOK_SECRET=&lt;app secret of your facebook app&gt;\nNEXTAUTH_URL=http:\/\/localhost:3000<\/pre>\n\n\n\n<p>Now,&nbsp;returned&nbsp;to our app. We\u2019re going to create a&nbsp;file&nbsp;named&nbsp;[&#8230;nextauth].js&nbsp;in&nbsp;pages\/api\/auth&nbsp;and&nbsp;add&nbsp;the following&nbsp;code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import NextAuth from &#039;next-auth&#039;;\nimport FacebookProvider from &#039;next-auth\/providers\/facebook&#039;;\n\nconst options = {\n    providers: &#091;\n        FacebookProvider({\n          clientId: process.env.FACEBOOK_ID,\n          clientSecret: process.env.FACEBOOK_SECRET\n        }),\n    ],\n}\n\nexport default (req, res) =&gt; NextAuth(req, res, options)<\/pre>\n\n\n\n<p>At Line 1, We are importing our main package (NextAuth). On line 2, we\u2019re importing our\u00a0<a href=\"https:\/\/next-auth.js.org\/providers\/facebook\" target=\"_blank\" rel=\"noreferrer noopener\">Facebook Providers<\/a>\u00a0from the\u00a0<code>next-auth<\/code>\u00a0library, <\/p>\n\n\n\n<p>which are services that we can integrate into our app to allow users to sign in.<\/p>\n\n\n\n<p>At Line 6, we\u2019re configuring our Facebook provider and passing in our Facebook secret and client ID through our environmental variables. <\/p>\n\n\n\n<p>Finally, on line 13, we\u2019re exporting a function that returns the NextAuth and takes in the options variable as a third parameter.<\/p>\n\n\n\n<p>Properly, the magic has\u00a0befallen\u00a0already. If we make use of the\u00a0<a href=\"https:\/\/next-auth.js.org\/getting-started\/rest-api\" target=\"_blank\" rel=\"noreferrer noopener\">REST API<\/a>\u00a0provided by\u00a0<code>next-auth<\/code>,<\/p>\n\n\n\n<p>we can log in to our app using our Facebook account. Navigate to\u00a0<code><a href=\"http:\/\/localhost:3000\/api\/auth\/signin\">http:\/\/localhost:3000\/api\/auth\/signin<\/a><\/code>\u00a0and you should see this\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"627\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/sign-in-1200x627.png\" alt=\"sign-in\" class=\"wp-image-368751\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/sign-in-1200x627.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/sign-in-300x157.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/sign-in-250x131.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/sign-in-768x401.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/sign-in.png 1526w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Sign In<\/figcaption><\/figure>\n\n\n\n<p>Follow the process. You are logged in. Now, we need to save and display the user login state.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Check user login state with the&nbsp;<code>useSession()<\/code>&nbsp;Hook<\/strong><\/h4>\n\n\n\n<p>We need to get the login state of our users and render user details on the front end of our app. This can be easily achieved by using a Next.js feature called\u00a0<a href=\"https:\/\/nextjs.org\/docs\/advanced-features\/custom-app\" target=\"_blank\" rel=\"noreferrer noopener\">custom app<\/a>. <\/p>\n\n\n\n<p>Then, we\u2019ll wrap our component in a Provider.<\/p>\n\n\n\n<p>Create an&nbsp;<code>_app.js<\/code>&nbsp;file in your&nbsp;<code>pages<\/code>&nbsp;directory (if it doesn\u2019t already exist) and add the following code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { SessionProvider } from &quot;next-auth\/react&quot;\nimport &#039;..\/styles\/globals.css&#039;\n\nfunction MyApp({ Component, pageProps }) {\n  return (\n    &lt;SessionProvider session={pageProps.session}&gt;\n      &lt;Component {...pageProps} \/&gt;\n    &lt;\/SessionProvider&gt;\n  )\n}\n\nexport default MyApp<\/pre>\n\n\n\n<p>By wrapping our components in a\u00a0<code>Session``Provider<\/code>, we enable session state to be shared between pages. <\/p>\n\n\n\n<p>This, in turn, will preserve our state during page navigation, improve performance, and reduce network traffic.<\/p>\n\n\n\n<p>Next, create the&nbsp;<code>components\/Header.js<\/code>&nbsp;file and import&nbsp;<code>useSession<\/code>,&nbsp;<code>signIn<\/code>, and&nbsp;<code>signOut<\/code>&nbsp;from&nbsp;<code>next-auth\/client<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { useSession, signIn, signOut } from &#039;next-auth\/react&#039;<\/pre>\n\n\n\n<p><code>useSession<\/code>&nbsp;will be used to manage the sign in and sign out state of our users, while&nbsp;<code>signIn<\/code>&nbsp;and&nbsp;<code>signOut<\/code>&nbsp;will be used to perform the login and logout features in our app.<\/p>\n\n\n\n<p>Let\u2019s make use of the&nbsp;<code>useSession<\/code>&nbsp;Hook:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">const { data: session } = useSession();<\/pre>\n\n\n\n<p>The session will return the user\u2019s details. Let\u2019s use the details returned to conditionally render a sign in and sign out button.<\/p>\n\n\n\n<p>Replace everything in the return statement in&nbsp;<code>components\/Header.js<\/code>&nbsp;with the following code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;div className=&quot;header&quot;&gt;\n      {session ? (\n        &lt;a href=&quot;#&quot; onClick={handleSignout} className=&quot;btn-signin&quot;&gt;\n          &lt;button&gt;Sign out&lt;\/button&gt;\n        &lt;\/a&gt;\n      ) : (\n        &lt;a href=&quot;#&quot; onClick={handleSignin} className=&quot;btn-signin&quot;&gt;\n          &lt;button&gt; Sign in&lt;\/button&gt;\n        &lt;\/a&gt;\n      )}\n&lt;\/div&gt;<\/pre>\n\n\n\n<p>We need to create the&nbsp;<code>handleSignin<\/code>&nbsp;and&nbsp;<code>handleSignout<\/code>&nbsp;methods to enable our users to sign in and sign out:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">const handleSignin = (e) =&gt; {\n    e.preventDefault();\n    signIn();\n  };\n\n  const handleSignout = (e) =&gt; {\n    e.preventDefault();\n    signOut();\n  };<\/pre>\n\n\n\n<p>Your&nbsp;<code>Header.js<\/code>&nbsp;should now look like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { useSession, signIn, signOut } from &#039;next-auth\/react&#039;\n\nexport default function Header () {\n  const { data: session } = useSession();\n\n  const handleSignin = (e) =&gt; {\n    e.preventDefault();\n    signIn();\n  };\n\n  const handleSignout = (e) =&gt; {\n    e.preventDefault();\n    signOut();\n  };\n\n  return (\n    &lt;div className=&quot;header&quot;&gt;\n      {session ? (\n        &lt;a href=&quot;#&quot; onClick={handleSignout} className=&quot;btn-signin&quot;&gt;\n          &lt;button&gt;Sign out&lt;\/button&gt;\n        &lt;\/a&gt;\n      ) : (\n        &lt;a href=&quot;#&quot; onClick={handleSignin} className=&quot;btn-signin&quot;&gt;\n          &lt;button&gt; Sign in&lt;\/button&gt;\n        &lt;\/a&gt;\n      )}\n    &lt;\/div&gt;\n  )\n}<\/pre>\n\n\n\n<p>Feel free to sign in and sign out of the app using the header button.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Retrieve and display user information<\/strong><\/h4>\n\n\n\n<p>Now, onto our&nbsp;<code>pages\/index.js<\/code>. We need to display and conditionally render user details based on their login details. First, we have to import the&nbsp;<code>useSession<\/code>&nbsp;hook from&nbsp;<code>next-auth<\/code>.<\/p>\n\n\n\n<p>So, replace your&nbsp;<code>index.js<\/code>&nbsp;with the following content:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import Head from &quot;next\/head&quot;;\nimport Header from &quot;..\/components\/Header&quot;;\nimport styles from &quot;..\/styles\/Home.module.css&quot;;\nimport { useSession } from &quot;next-auth\/react&quot;;\n\nexport default function Home() {\n  const { data: session, status } = useSession();\n  const loading = status === &quot;loading&quot;;\n\n  return (\n    &lt;div className={styles.container}&gt;\n      &lt;Head&gt;\n        &lt;title&gt;Nextjs | Next-Auth&lt;\/title&gt;\n        &lt;link rel=&quot;icon&quot; href=&quot;\/favicon.ico&quot; \/&gt;\n      &lt;\/Head&gt;\n      &lt;Header \/&gt;\n      &lt;main className={styles.main}&gt;\n        &lt;h1 className={styles.title}&gt;\n          Authentication in Next.js app using Next-Auth\n        &lt;\/h1&gt;\n        &lt;div className={styles.user}&gt;\n          {loading &amp;&amp; &lt;div className={styles.title}&gt;Loading...&lt;\/div&gt;}\n          {session ? (\n            &lt;&gt;\n              &lt;p style={{ marginBottom: &quot;10px&quot; }}&gt;\n                Welcome, {session.user.name ?? session.user.email}\n              &lt;\/p&gt;\n              &lt;br \/&gt;\n              &lt;img src={session.user.image} alt=&quot;&quot; className={styles.avatar} \/&gt;\n            &lt;\/&gt;\n          ) : (\n            &lt;p className={styles.title}&gt;Please Sign in&lt;\/p&gt;\n          )}\n        &lt;\/div&gt;\n      &lt;\/main&gt;\n    &lt;\/div&gt;\n  );\n}<\/pre>\n\n\n\n<p>In this code, we are conditionally rendering the user\u2019s image, name, and photo using the data from our session state if the user is logged into our app. <\/p>\n\n\n\n<p>If the user is not logged in, we display a dummy GIF with text instructing them to sign in.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"859\" height=\"735\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignIn.png\" alt=\"SignIn\" class=\"wp-image-368755\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignIn.png 859w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignIn-300x257.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignIn-250x214.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignIn-768x657.png 768w\" sizes=\"(max-width: 859px) 100vw, 859px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Welcome<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Google<\/h2>\n\n\n\n<p>To allow users to log in to our app using their Google account, we have to obtain OAuth 2.0 client credentials from the\u00a0<a href=\"https:\/\/console.developers.google.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Google API Console<\/a>. <\/p>\n\n\n\n<p>Navigate to\u00a0<strong>C<\/strong><em>redentials<\/em>\u00a0and click on\u00a0<strong>Create credentials<\/strong>, and then\u00a0<strong>OAuth client ID<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"584\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/google-create-api-1200x584.png\" alt=\"google-create-api\" class=\"wp-image-368756\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/google-create-api-1200x584.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/google-create-api-300x146.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/google-create-api-250x122.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/google-create-api-768x374.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/google-create-api-1536x747.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/google-create-api.png 1546w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\"><strong><em>Create a Google OAuth client ID.<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>Fill in the following options as asked:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Choose an Application Type<\/strong>: Select&nbsp;<strong>Web Application<\/strong><\/li>\n\n\n\n<li><strong>Name<\/strong>: This is the name of your application<\/li>\n\n\n\n<li><strong>Authorized JavaScript origins<\/strong>: This is the full URL to the homepage of our app. Since we are still in development mode, we are going to fill in the full URL our development server is running on. In this case, it is&nbsp;<code><a href=\"http:\/\/localhost:3000\/\">http:\/\/localhost:3000<\/a><\/code><\/li>\n\n\n\n<li><strong>Authorized redirect URIs<\/strong>: Redirected to this&nbsp;route&nbsp;after customers&nbsp;will authenticated with Google:&nbsp;<code><a href=\"http:\/\/localhost:3000\/api\/auth\/callback\/google\">http:\/\/localhost:3000\/api\/auth\/callback\/google<\/a><\/code><\/li>\n<\/ul>\n\n\n\n<p>Next, a popup will display your client ID and client secret.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"584\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/OAuthGoogle-1200x584.png\" alt=\"OAuthGoogle\" class=\"wp-image-368762\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/OAuthGoogle-1200x584.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/OAuthGoogle-300x146.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/OAuthGoogle-250x122.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/OAuthGoogle-768x374.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/OAuthGoogle-1536x748.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/OAuthGoogle.png 1545w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\"><strong><em>Created Google OAuth client ID and secret ID.<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>Copy and add them to your&nbsp;<code>env.local<\/code>&nbsp;file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">GOOGLE_ID=&lt;client id of your google auth app should go in here&gt;\nGOOGLE_SECRET=&lt;client secret of your google auth app should go in here&gt;<\/pre>\n\n\n\n<p>Next, navigate to&nbsp;<code>pages\/api\/auth\/[...nextauth].js<\/code>&nbsp;and add the following to your array of providers:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import GoogleProvider from &#039;next-auth\/providers\/google&#039;;\n...\n   GoogleProvider({\n      clientId: process.env.GOOGLE_ID,\n      clientSecret: process.env.GOOGLE_SECRET,\n    }),\n...<\/pre>\n\n\n\n<p>Your&nbsp;<code>[...nextauth].js<\/code>&nbsp;should now look like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import NextAuth from &quot;next-auth&quot;;\nimport FacebookProvider from &quot;next-auth\/providers\/facebook&quot;;\nimport GoogleProvider from &#039;next-auth\/providers\/google&#039;;\n\nconst options = {\n  providers: &#091;\n    FacebookProvider({\n      clientId: process.env.FACEBOOK_ID,\n      clientSecret: process.env.FACEBOOK_SECRET,\n    }),\n    GoogleProvider({\n      clientId: process.env.GOOGLE_ID,\n      clientSecret: process.env.GOOGLE_SECRET,\n    }),\n  ],\n};\n\nexport default (req, res) =&gt; NextAuth(req, res, options);<\/pre>\n\n\n\n<p>Restart the development server using <code>npm run dev<\/code>. After the server starts, test the authentication by signing in to your app with your Google account.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"630\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignInWithGoogle-1200x630.png\" alt=\"SignInWithGoogle\" class=\"wp-image-368764\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignInWithGoogle-1200x630.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignInWithGoogle-300x157.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignInWithGoogle-250x131.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignInWithGoogle-768x403.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SignInWithGoogle.png 1513w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\"><strong><em>Sign in with Google<\/em><\/strong>.<\/figcaption><\/figure>\n\n\n\n<p>After you&nbsp;restart your&nbsp;development&nbsp;server,&nbsp;customers&nbsp;should&nbsp;be&nbsp;capable of&nbsp;logging in&nbsp;on your&nbsp;Next.js app&nbsp;with the use of&nbsp;their Google, and&nbsp;Facebook accounts.<\/p>\n\n\n\n<p>That\u2019s all about the <a href=\"https:\/\/store.webkul.com\/magento2-social-login.html\">Social Login<\/a> with NextAuth. If you have any questions please comment below, and we will try to respond to you.<\/p>\n\n\n\n<p>To implement authentication in Nextjs with <a href=\"https:\/\/store.webkul.com\/Magento-2.html\">Magento 2<\/a> using the NextAuth credentials provider, check out our previous blog: <a href=\"https:\/\/webkul.com\/blog\/how-to-implement-authentication-in-nextjs-with-magento2-using-credentials-provider\/\">Click Here<\/a><\/p>\n\n\n\n<p>Happy coding \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps. What is Next.js? Next.js is a flexible&nbsp;React framework&nbsp;that gives you building blocks to create fast&nbsp;web applications. Next.js is a framework built on top of React that makes developing production-ready, fully-optimized React apps super fast and easy. <a href=\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":377,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13575,6357],"tags":[12572,12571,6359,2519],"class_list":["post-368461","post","type-post","status-publish","format-standard","hentry","category-next-js","category-react-js","tag-next-js","tag-nextauth","tag-react-js","tag-social-login"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to implement Social Login in Nextjs (React) using NextAuth<\/title>\n<meta name=\"description\" content=\"In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to implement Social Login in Nextjs (React) using NextAuth\" \/>\n<meta property=\"og:description\" content=\"In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-14T12:31:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-09T12:06:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png\" \/>\n<meta name=\"author\" content=\"Rahul Chaudhary\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rahul Chaudhary\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\"},\"author\":{\"name\":\"Rahul Chaudhary\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/07d5b40e4a4b5c6996d171e134826b75\"},\"headline\":\"How to implement Social Login in Nextjs (React) using NextAuth\",\"datePublished\":\"2023-02-14T12:31:27+00:00\",\"dateModified\":\"2026-03-09T12:06:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\"},\"wordCount\":1251,\"commentCount\":8,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png\",\"keywords\":[\"Next.js\",\"NextAuth\",\"react js\",\"social login\"],\"articleSection\":[\"next js\",\"react js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\",\"name\":\"How to implement Social Login in Nextjs (React) using NextAuth\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png\",\"datePublished\":\"2023-02-14T12:31:27+00:00\",\"dateModified\":\"2026-03-09T12:06:38+00:00\",\"description\":\"In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType.png\",\"width\":1533,\"height\":758,\"caption\":\"SelectType\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to implement Social Login in Nextjs (React) using NextAuth\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/07d5b40e4a4b5c6996d171e134826b75\",\"name\":\"Rahul Chaudhary\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/40e957d926aaa241dc1de7dd09cfea4a0c86ed9fa29bb7eda51de1a8967864e7?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/40e957d926aaa241dc1de7dd09cfea4a0c86ed9fa29bb7eda51de1a8967864e7?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Rahul Chaudhary\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/rahulchaudhary766\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to implement Social Login in Nextjs (React) using NextAuth","description":"In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/","og_locale":"en_US","og_type":"article","og_title":"How to implement Social Login in Nextjs (React) using NextAuth","og_description":"In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps.","og_url":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-02-14T12:31:27+00:00","article_modified_time":"2026-03-09T12:06:38+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png","type":"","width":"","height":""}],"author":"Rahul Chaudhary","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Rahul Chaudhary","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/"},"author":{"name":"Rahul Chaudhary","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/07d5b40e4a4b5c6996d171e134826b75"},"headline":"How to implement Social Login in Nextjs (React) using NextAuth","datePublished":"2023-02-14T12:31:27+00:00","dateModified":"2026-03-09T12:06:38+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/"},"wordCount":1251,"commentCount":8,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png","keywords":["Next.js","NextAuth","react js","social login"],"articleSection":["next js","react js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/","url":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/","name":"How to implement Social Login in Nextjs (React) using NextAuth","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType-1200x593.png","datePublished":"2023-02-14T12:31:27+00:00","dateModified":"2026-03-09T12:06:38+00:00","description":"In this blog, we will discuss how to implement Social Login in Nextjs (React) using NextAuth for your apps.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/SelectType.png","width":1533,"height":758,"caption":"SelectType"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-implement-social-login-in-nextjs-react-using-nextauth\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to implement Social Login in Nextjs (React) using NextAuth"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/07d5b40e4a4b5c6996d171e134826b75","name":"Rahul Chaudhary","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/40e957d926aaa241dc1de7dd09cfea4a0c86ed9fa29bb7eda51de1a8967864e7?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/40e957d926aaa241dc1de7dd09cfea4a0c86ed9fa29bb7eda51de1a8967864e7?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Rahul Chaudhary"},"url":"https:\/\/webkul.com\/blog\/author\/rahulchaudhary766\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/368461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/377"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=368461"}],"version-history":[{"count":14,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/368461\/revisions"}],"predecessor-version":[{"id":529684,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/368461\/revisions\/529684"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=368461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=368461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=368461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}