<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mateen Ahmed</title>
    <description>The latest articles on DEV Community by Mateen Ahmed (@vyperx2).</description>
    <link>https://dev.to/vyperx2</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1245325%2Fb2fd5d00-e57d-4f0c-a47b-bdae4e57735c.png</url>
      <title>DEV Community: Mateen Ahmed</title>
      <link>https://dev.to/vyperx2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vyperx2"/>
    <language>en</language>
    <item>
      <title>Setting up Next Auth to Register with Google</title>
      <dc:creator>Mateen Ahmed</dc:creator>
      <pubDate>Tue, 02 Jan 2024 09:55:18 +0000</pubDate>
      <link>https://dev.to/vyperx2/setting-up-next-auth-to-register-with-google-535n</link>
      <guid>https://dev.to/vyperx2/setting-up-next-auth-to-register-with-google-535n</guid>
      <description>&lt;p&gt;Setting up Authentication for a project might seem difficult, but it is quite easy to enable &lt;strong&gt;Google&lt;/strong&gt; authentication with &lt;strong&gt;Next Auth&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm currently working on a next js social media app for practice and here's how to set up Google authentication quickly and easily&lt;/p&gt;

&lt;p&gt;In your next JS project install the next-auth Library&lt;br&gt;
&lt;a href="https://authjs.dev/reference/nextjs"&gt;Checkout the docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--blUsZ-d6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rwuwx3blwnfzwo5c76z5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--blUsZ-d6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rwuwx3blwnfzwo5c76z5.png" alt="Image description" width="800" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We then copy this piece of code from the docs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
export const { handlers, auth } = NextAuth({ providers: [ GitHub ] })

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a file named auth.js or auth.ts (if using typescript)&lt;br&gt;
create the file in the *&lt;em&gt;lib *&lt;/em&gt; folder (lib/auth.ts)&lt;/p&gt;

&lt;p&gt;The code can now be modified for Google authentication&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import NextAuth from "next-auth"
import Google from "next-auth/providers/google"
export const { handlers, auth } = NextAuth({ providers: [ Google ] })
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need the clientId and the clientSecret from Google.&lt;/p&gt;

&lt;p&gt;Head to &lt;a href="https://console.cloud.google.com/"&gt;Google Cloud console&lt;/a&gt;&lt;br&gt;
and create a project or select one&lt;/p&gt;

&lt;p&gt;Then in the sidebar under APIs and services select Credentials&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nGrMFr9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vba4v7x75a87ewn1afvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nGrMFr9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vba4v7x75a87ewn1afvf.png" alt="Image description" width="498" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click on Create credentials&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ly2hjlaL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lh5f7rmdsbu9bmcfn6t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ly2hjlaL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lh5f7rmdsbu9bmcfn6t.png" alt="Image description" width="800" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and then on OAuth Client ID&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fksqcyKq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21o5pczspgd8ga1v0k4m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fksqcyKq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21o5pczspgd8ga1v0k4m.png" alt="Image description" width="497" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select application type as Web application&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qE1qU3TW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ejvw02ltwjlhit4foit9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qE1qU3TW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ejvw02ltwjlhit4foit9.png" alt="Image description" width="589" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add Authorized JavaScript origins as &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; (during development)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--967ivIHq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h7d3vw0eye23yjmc442z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--967ivIHq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h7d3vw0eye23yjmc442z.png" alt="Image description" width="562" height="226"&gt;&lt;/a&gt;&lt;br&gt;
Then click on create &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XPBDQsCt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hs68xy5zj1f3njswv42b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XPBDQsCt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hs68xy5zj1f3njswv42b.png" alt="Image description" width="537" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Store the Credentials in your .env file&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I-3Qtwp---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wq0r7jomevfg51zu2eic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I-3Qtwp---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wq0r7jomevfg51zu2eic.png" alt="Image description" width="788" height="67"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the Credentials section go to your Web Client (or whatever if you changed the name)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UBxPsCiZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qoqryh5lzsqp7gpgahdd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UBxPsCiZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qoqryh5lzsqp7gpgahdd.png" alt="Image description" width="224" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And add this in the authorized redirect URIs&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CquggeKu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekeq8rlr6kbdd2qsjwvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CquggeKu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekeq8rlr6kbdd2qsjwvh.png" alt="Image description" width="629" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the .env file, you have to set NEXTAUTH_URL and NEXTAUTH_SECRET&lt;/p&gt;

&lt;p&gt;Set the NEXAUTH_URL as &lt;a href="http://localhost:3000/api/auth"&gt;http://localhost:3000/api/auth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hOMB8MZv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bq9ieka4kfdgpcpywft1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hOMB8MZv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bq9ieka4kfdgpcpywft1.png" alt="Image description" width="632" height="35"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And generate the NEXTAUTH_SECRET from this &lt;a href="https://www.cryptool.org/en/cto/openssl"&gt;openssl terminal&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl rand -base64 32
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now update the auth.ts file like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const {
    handlers: { GET, POST },
    auth,
    signIn,
    signOut,
} = NextAuth({
    providers: [
        Google({
            clientId: process.env.GOOGLE_ID,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET,
        }),
    ],
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create a new route.ts file in the app/api/auth/[...nextauth]&lt;br&gt;
folder.&lt;/p&gt;

&lt;p&gt;It will only contain this&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export { GET, POST } from "@/lib/auth";&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create a form with an action&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form action={handleGoogleLogin}&amp;gt;
    &amp;lt;button&amp;gt;Sign Up with Google&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleGoogleLogin = async () =&amp;gt; {
    "use server";
    await signIn("google");
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the signIn function should be imported from the auth.ts file &lt;br&gt;
Your Google Authentication has been setup&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to use Shadcn-ui Themes</title>
      <dc:creator>Mateen Ahmed</dc:creator>
      <pubDate>Mon, 01 Jan 2024 10:48:24 +0000</pubDate>
      <link>https://dev.to/vyperx2/how-to-use-shadcn-ui-themes-30al</link>
      <guid>https://dev.to/vyperx2/how-to-use-shadcn-ui-themes-30al</guid>
      <description>&lt;p&gt;On the shadcn-ui home page, you can select multiple themes apart from the basic ones which include &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Red&lt;/li&gt;
&lt;li&gt;Rose&lt;/li&gt;
&lt;li&gt;Green&lt;/li&gt;
&lt;li&gt;Blue&lt;/li&gt;
&lt;li&gt;Yellow&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And a few others, but when you install shadcn in a project you only get the option to select the basic themes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0FTGWD7t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xmyr809edhu2vn0hr10j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0FTGWD7t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xmyr809edhu2vn0hr10j.png" alt="Image description" width="800" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To be able to use the above mentioned themes, you have to first select any option.&lt;/p&gt;

&lt;p&gt;After installing the basic theme, you can go to the home page and select whichever theme you want to use.&lt;br&gt;
I will be using blue for this example&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NRpzdyVJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73sky3f75itrr7pkqlnr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NRpzdyVJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73sky3f75itrr7pkqlnr.png" alt="Image description" width="731" height="87"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the copy code button after choosing a theme.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xr8ydbWt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oz6wcsjuvnjdpqilg0fk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xr8ydbWt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oz6wcsjuvnjdpqilg0fk.png" alt="Image description" width="739" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After copying the code you have to replace the colors in your globals.css with the newly copied colors&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ia3izMJ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgcbcs5i5w7v7ieu8ugh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ia3izMJ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgcbcs5i5w7v7ieu8ugh.png" alt="Image description" width="800" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, nothing seems to be applied. To see the background color you need to add the &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;dark&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bfBmwuDm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0amc8ilemndyctnr4rsg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bfBmwuDm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0amc8ilemndyctnr4rsg.png" alt="Image description" width="800" height="79"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;property on the body (in case you are using dark mode)&lt;br&gt;
otherwise, your new theme is set correctly&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qF9Df8Bs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5v8pnq2g6v7qrj10dukf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qF9Df8Bs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5v8pnq2g6v7qrj10dukf.png" alt="Image description" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>nextjs</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Making a Next JS Social Media Site</title>
      <dc:creator>Mateen Ahmed</dc:creator>
      <pubDate>Mon, 01 Jan 2024 10:00:19 +0000</pubDate>
      <link>https://dev.to/vyperx2/making-a-next-js-social-media-site-1dkk</link>
      <guid>https://dev.to/vyperx2/making-a-next-js-social-media-site-1dkk</guid>
      <description>&lt;p&gt;I want to level up my web development skills, so to practice I am thinking of making a full-stack social media app without following a long tutorial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technologies that I will use:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;Next JS&lt;/li&gt;
&lt;li&gt;Tailwind CSS&lt;/li&gt;
&lt;li&gt;Typescript&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'm quite familiar with React but at a beginner level in Next JS and Typescript&lt;br&gt;
So my goal is to be able to learn these things while building something I will be proud of.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features I want the app to have:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Proper Backend (MongoDB)&lt;/li&gt;
&lt;li&gt;Real Time Messaging&lt;/li&gt;
&lt;li&gt;Following users&lt;/li&gt;
&lt;li&gt;Likes for posts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Things I want to learn through this project:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.Prisma (for database models)&lt;br&gt;
2.MongoDB&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Managing File Uploads&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Name of the site (AI generated):&lt;br&gt;
Vortex&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, I don't have a design in mind and since I am a developer and not a designer, I might look for a design on Figma.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
