<?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: Sivanesh Shanmugam</title>
    <description>The latest articles on DEV Community by Sivanesh Shanmugam (@sivaneshs).</description>
    <link>https://dev.to/sivaneshs</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%2F349996%2F90db7924-7733-4aba-b3f9-dac78b90bf9e.jpg</url>
      <title>DEV Community: Sivanesh Shanmugam</title>
      <link>https://dev.to/sivaneshs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sivaneshs"/>
    <language>en</language>
    <item>
      <title>7 reasons why frontend web performance optimization is important?</title>
      <dc:creator>Sivanesh Shanmugam</dc:creator>
      <pubDate>Wed, 06 Aug 2025 17:29:09 +0000</pubDate>
      <link>https://dev.to/sivaneshs/7-reasons-why-frontend-web-performance-optimization-is-important-3c1j</link>
      <guid>https://dev.to/sivaneshs/7-reasons-why-frontend-web-performance-optimization-is-important-3c1j</guid>
      <description>&lt;p&gt;Web frontend performance and its monitoring are critically important. They directly affect user satisfaction, engagement, and ultimately the success of your online business. 🚀&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;BBC found they lost an additional 10% of users for every additional second their site took to load.&lt;/li&gt;
&lt;li&gt;Statistics indicate that 40% of visitors will leave a website if it takes longer than three seconds to load.&lt;/li&gt;
&lt;li&gt;Prefetching contents helped Terra increase ads click-through rate by 30% and speeds up LCP.&lt;/li&gt;
&lt;li&gt;RedBus improved their website's Interaction to Next Paint (INP) metric and increased sales by 7%&lt;/li&gt;
&lt;li&gt;64% of dissatisfied shoppers do not visit a slow website again&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Web Frontend performance and its monitoring is so important as it directly impacts user satisfaction, engagement, and ultimately, the success of your online business.&lt;/p&gt;

&lt;p&gt;Performance plays a vital role in the success of any online venture. Websites that load quickly and respond to user input in a timely fashion engage and retain users better than websites that are slow to load, and feel sluggish.&lt;/p&gt;

&lt;p&gt;Here are the reasons why web performance is crucial. The first four reasons primarily stem from user psychology.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Best User Experience (UX)
&lt;/h2&gt;

&lt;p&gt;Frontend performance directly impacts user experience. Faster loading times and smoother interactions enhance user satisfaction and engagement, leading to higher retention rates and increased conversion rates.&lt;/p&gt;

&lt;p&gt;When users encounter swift response times and seamless interactions, they develop a positive perception of the application. This perception extends beyond just speed—it suggests that the developers have invested in creating a polished and dependable product. This perception of quality can enhance user trust and loyalty over time.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✨ Optimized web performance fosters engagement and encourages users to explore further, leading to increased interaction with content and higher retention rates.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. Customer Retention
&lt;/h2&gt;

&lt;p&gt;Providing a fast and responsive frontend experience enhances customer satisfaction and retention. Users are more likely &lt;strong&gt;to return to and recommend a product&lt;/strong&gt; that performs well and meets their expectations. Positive user experiences contribute to building brand loyalty and long-term customer relationships.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🚀 &lt;em&gt;If you care about retaining users, then you should be focusing on performance!&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A slow app, on the other hand, may convey a sense of neglect or incompetence, leaving users with &lt;strong&gt;a negative impression of the brand or organization&lt;/strong&gt; behind it. In today's competitive landscape, where user expectations continue to rise, maintaining a reputation for excellence and proficiency is essential for building trust and credibility.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Reduced Bounce Rates
&lt;/h2&gt;

&lt;p&gt;Users are more likely to abandon a website if it loads slowly. By optimizing performance, you can decrease bounce rates and retain visitors for longer periods.&lt;/p&gt;

&lt;p&gt;As mentioned above&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🐌 Statistics indicate that 40% of visitors will leave a website if it takes longer than three seconds to load.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwz73xszxiqid9eio5vrs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwz73xszxiqid9eio5vrs.png" alt="Bar chart on number of users leave after n seconds of loading time" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Reduced Cognitive Load
&lt;/h2&gt;

&lt;p&gt;Slow-loading apps impose cognitive burdens on users, requiring them to allocate additional mental resources to process and interpret the delay. Users may experience frustration, impatience, or anxiety while waiting for content to load, detracting from their overall experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0wjjvlxixwngrcl5hmg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0wjjvlxixwngrcl5hmg.png" alt="level of stress caused by mobile delays" width="768" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The stat from above says that the** level of stress caused by the delays in an app is almost equal as watching a horror movie**. This holds particularly true for applications that contain critical updates and information.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;😰 I've personally experienced these frustrations while working to complete an important form on a bank or government website.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In contrast, faster apps reduce cognitive load by minimizing wait times and cognitive friction. Users can focus their attention on the task at hand without being distracted by performance-related issues, leading to a more immersive and enjoyable experience.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Competitive Advantage
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjj40qsztseqf1myynijc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjj40qsztseqf1myynijc.png" alt="Running race" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today's competitive market, businesses need to differentiate themselves from competitors. A fast and responsive frontend can be a significant competitive advantage. Users are more likely to choose a product or service that offers a better user experience and faster performance over slower alternatives.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Search Engine Optimization (SEO)
&lt;/h2&gt;

&lt;p&gt;Search engines like Google consider website performance as one of the ranking factors. Faster websites are more likely to rank higher in search engine results pages (SERPs) compared to slower ones. By optimizing frontend performance, startups and businesses can improve their visibility in search engine results and attract more organic traffic to their website.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Enhancing Accessibility: Optimizing for Low-End Devices and Sparse Networks
&lt;/h2&gt;

&lt;p&gt;If your website doesn't adhere to web best practices or lacks performance optimizations, there's a significant risk of losing a large segment of potential customers. These customers include individuals who:&lt;/p&gt;

&lt;p&gt;Are on the move (e.g., using Metro, Bus, or Car)&lt;br&gt;
Use low-end devices&lt;br&gt;
Reside in areas with limited network coverage&lt;br&gt;
To ensure a seamless user experience for these individuals, our web application should be designed to be easily usable and functional under various challenging conditions.&lt;/p&gt;

&lt;p&gt;By ensuring that your site loads quickly and functions smoothly across different platforms, &lt;strong&gt;you can reach a wider audience&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Implementing &lt;strong&gt;effective caching strategies&lt;/strong&gt;, optimizing the use of Content Delivery Networks (&lt;strong&gt;CDNs&lt;/strong&gt;), and &lt;strong&gt;enabling offline access&lt;/strong&gt; (among other tactics) ensure that users can continue using our application seamlessly, even in the event of a temporary loss of network or adverse conditions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ℹ️ While you may not directly observe identical statistics between a B2C and a B2B product, as mentioned in this blog. But for sure, the influence of web performance on decision-making processes remains significant across both domains.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In summary, the speed of an app influences user's perceptions, emotions, and behaviors in profound ways. By prioritizing speed and performance, developers can create experiences that empower, delight, and inspire users, fostering long-term relationships and driving business success.&lt;/p&gt;

&lt;p&gt;Thanks for reading the blog!&lt;/p&gt;

&lt;p&gt;For more case studies like this, follow individual companies Engineering Blogs, or Web dev case studies.&lt;/p&gt;




&lt;p&gt;View my &lt;a href="https://sivanesh.dev/blog/why-frontend-performance-optimization-is-important" rel="noopener noreferrer"&gt;original blog post&lt;/a&gt; for all the references used in this blog.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Create mock APIs for building frontend apps quickly without the backend.</title>
      <dc:creator>Sivanesh Shanmugam</dc:creator>
      <pubDate>Sun, 09 Oct 2022 07:35:12 +0000</pubDate>
      <link>https://dev.to/sivaneshs/create-mock-apis-for-building-frontend-apps-quickly-without-the-backend-2lm2</link>
      <guid>https://dev.to/sivaneshs/create-mock-apis-for-building-frontend-apps-quickly-without-the-backend-2lm2</guid>
      <description>&lt;p&gt;Whenever a team plans to build a feature, (If the team has dedicated Backend and Frontend developers), the frontend and backend tasks will be assigned simultaneously. &lt;/p&gt;

&lt;p&gt;After confirming the use cases and the API Designs, It will be cool if we (Frontend Developers) have a mock API ready so that we can start building our features, and then it will require 0 to minimal effort when connecting the backend once it is ready. So knowing the methods and tools to create mock APIs will help you build apps faster.&lt;/p&gt;

&lt;h1&gt;
  
  
  Random Data Generators
&lt;/h1&gt;

&lt;p&gt;In order to create mock APIs, we need some ways to generate mock data. These data will help us a lot in the future as well apart from the initial development. Like **testing, component documentation, **etc. So to create mock APIs we can either use &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Mockaroo&lt;/li&gt;
&lt;li&gt;FakerJS&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://www.mockaroo.com/" rel="noopener noreferrer"&gt;Mockaroo&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Fmockaroo.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Fmockaroo.jpeg"&gt;&lt;/a&gt;Mockaroo Page with a simple user schema&lt;br&gt;
Create fields with the name and their types. Choose the number of rows and change the format to JSON (Or any format in which your API exists). Download it and import them for usage. The free version is enough for most cases.&lt;/p&gt;

&lt;p&gt;You can even create and save schemas so that you can make use of those schemas to get data later.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://fakerjs.dev/" rel="noopener noreferrer"&gt;Faker JS&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Ffaker-code.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Ffaker-code.png"&gt;&lt;/a&gt;FakerJS code for generating names and emails&lt;br&gt;
Obtain values with the utility functions they provide and create datasets based on your API design. You can use the utility functions provided by the library to create random data.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Ffaker-data.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Ffaker-data.jpeg"&gt;&lt;/a&gt;Type of utility list provided by the FakerJS Docs&lt;br&gt;
So with the above tools, we can generate the data we needed. So you can use these as datasets for the Mock APIs that you will be creating.&lt;/p&gt;




&lt;h1&gt;
  
  
  Create Mock APIs
&lt;/h1&gt;

&lt;p&gt;The rest of the blog explains how to create Mock APIs. There are multiple methods mentioned here to create Mock APIs. You can choose a method that suits you based on your requirement.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next.js API (Ignore this if you aren't using Next.JS)&lt;/li&gt;
&lt;li&gt;JSON Server&lt;/li&gt;
&lt;li&gt;Mirage JS&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Next.js API
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt; is a full-stack framework on top of React. So if you are using Next.js you know we can create API Routes. No new setup is required. We'll just make use of it for mock API.&lt;/p&gt;

&lt;p&gt;For eg: Just create a file under &lt;code&gt;pages/api/candidate.js&lt;/code&gt; and send the data you created. API Endpoint: &lt;code&gt;/api/candidate&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2FNextjs-API.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2FNextjs-API.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;json-server&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This is the most widely used approach for creating Mock APIs. It has &lt;a href="https://github.com/typicode/json-server" rel="noopener noreferrer"&gt;63K Github Stars&lt;/a&gt; and around &lt;a href="https://www.npmjs.com/package/json-server" rel="noopener noreferrer"&gt;200k npm weekly downloads&lt;/a&gt;. Getting started with &lt;code&gt;json-server&lt;/code&gt; is very easy. You can refer the &lt;a href="https://www.npmjs.com/package/json-server" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Fjson-server.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsivanesh.dev%2Fcontent%2Fimages%2F2022%2F09%2Fjson-server.png"&gt;&lt;/a&gt;A screenshot from the docs describes creating a mock API&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://miragejs.com/" rel="noopener noreferrer"&gt;Mirage JS&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;If you are building an enterprise-level product with complex app logic then Mirage JS would be the perfect fit for you.&lt;/p&gt;

&lt;p&gt;It takes some time for setting up Mirage. Once done, It’ll provide a perfect developer experience. As you can use Mirage to create APIs for both new and existing projects allowing existing APIs to pass through.&lt;/p&gt;




&lt;p&gt;These were the methods that I use when creating mock APIs for Frontend Development. If you have some better ideas please let us know. 😃&lt;/p&gt;

&lt;p&gt;For more blogs like these, you can visit my blog &lt;a href="https://sivanesh.dev" rel="noopener noreferrer"&gt;sivanesh.dev&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Add Google Login to your React Apps in 10 mins</title>
      <dc:creator>Sivanesh Shanmugam</dc:creator>
      <pubDate>Sat, 27 Jun 2020 12:49:34 +0000</pubDate>
      <link>https://dev.to/sivaneshs/add-google-login-to-your-react-apps-in-10-mins-4del</link>
      <guid>https://dev.to/sivaneshs/add-google-login-to-your-react-apps-in-10-mins-4del</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fu3e0jxnva6te9a3kx5ji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fu3e0jxnva6te9a3kx5ji.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a client developer, Creating apps with authentication might be a tedious process. As we need to handle authentication in the server and maintain the code. It does have some multiple cases to be maintained based on authentication mechanisms. (Basic, OAuth, etc) This blog helps you create a standalone backend less authentication for your react app. (or additionally) you can add server configurations too to authenticate with your server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why OAuth?
&lt;/h2&gt;

&lt;p&gt;There are many reasons to use OAuth. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is secure.&lt;/li&gt;
&lt;li&gt;It doesn't require any credentials from the user. So no need of remembering multiple passwords.&lt;/li&gt;
&lt;li&gt;Websites can also get essential information about users without spending much time in forms.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And specifically in our case, we don't need a server to authenticate or to get initial details of the user. 😉&lt;/p&gt;

&lt;p&gt;I found a package which is called as &lt;code&gt;react-google-login&lt;/code&gt;. Which provides simple mechanisms to add the Google login. You can either directly use their &lt;code&gt;GoogleLogin&lt;/code&gt; component or you can use custom buttons. They also provide custom hooks like  &lt;code&gt;useGoogleLogin&lt;/code&gt; and &lt;code&gt;useGoogleLogout&lt;/code&gt; so it will be easy for hooks lovers. &lt;em&gt;(Both methods are described below)&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;The &lt;a href="//npmjs.com/package/react-google-login"&gt;documentation&lt;/a&gt; they provided for this repository is awesome. But it's missing in some ways which are addressed in this blog. Like in detail, this blog helps in creating your application in the Google developer console and access &lt;code&gt;clientId&lt;/code&gt;.  The initial &lt;code&gt;access_token&lt;/code&gt; obtained by this package will last for only one hour (&lt;em&gt;For security reasons).&lt;/em&gt; And we need to iterate the process to access the new &lt;code&gt;access_token&lt;/code&gt; using &lt;code&gt;refresh_token&lt;/code&gt;. So you can make a &lt;strong&gt;production-ready application.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We need to create an application in the Google developer console. It provides &lt;code&gt;clientId&lt;/code&gt; is used to identify your application for authentication details. Follow the below steps to get the client ID.

&lt;ol&gt;
&lt;li&gt;Go to the &lt;a href="https://console.developers.google.com/apis/credentials" rel="noopener noreferrer"&gt;Credentials page&lt;/a&gt;. &lt;em&gt;( if you are new, then &lt;a href="https://console.developers.google.com/projectcreate" rel="noopener noreferrer"&gt;create a project&lt;/a&gt; and follow these steps)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create credentials &amp;gt; OAuth client ID&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Web application&lt;/strong&gt; type.&lt;/li&gt;
&lt;li&gt;Name your OAuth 2.0 client and click &lt;strong&gt;Create&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Make sure you provided your domain and redirect URL. So that Google identifies the origin domain to which it can provide authentication.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhhihbf8d3k4pvul9br19.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also add your local route for development. Now authentication setup in Google developer console is ready.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lets code
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyj64on55mqjghaszl1ot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyj64on55mqjghaszl1ot.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's start with code. &lt;a href="https://github.com/sivanesh-s/react-google-authentication/" rel="noopener noreferrer"&gt;View my repo&lt;/a&gt; for accessing all code snippets. View &lt;a href="https://sivanesh-s.github.io/react-google-authentication/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In your CRA install &lt;code&gt;react-google-login&lt;/code&gt; package&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;react-google-login&lt;/span&gt;&lt;span class="w"&gt;


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

&lt;/div&gt;

&lt;p&gt;Create a &lt;code&gt;Login&lt;/code&gt; component that acts as a login button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw9aw8o6ef8cbmrla9o4g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw9aw8o6ef8cbmrla9o4g.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, create a &lt;code&gt;Logout&lt;/code&gt; component&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F83ty6je2wy3anjyb0jed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F83ty6je2wy3anjyb0jed.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And add both in the required location of your app. Mine is in &lt;code&gt;App.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb3do0if6wxwj5nhmy7l8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb3do0if6wxwj5nhmy7l8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now running your application will show &lt;code&gt;profileObj&lt;/code&gt; in the console after logging in.&lt;/p&gt;

&lt;p&gt;Congrats 🎉 You successfully made it 😃.&lt;/p&gt;

&lt;p&gt;But after 1 hour your &lt;code&gt;tokenId&lt;/code&gt; gets expired and hence it won't be used to access data or authenticate users. And hence we need to generate new &lt;code&gt;tokenId&lt;/code&gt;. To make things work we need to add some additional cases in the &lt;code&gt;Login&lt;/code&gt; component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fiphh0mab7jmr7y9pv0na.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fiphh0mab7jmr7y9pv0na.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;refreshTokenSetup&lt;/code&gt; function will take care of handling new &lt;code&gt;tokenIds&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffgw32rcpf6piy6q42kbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffgw32rcpf6piy6q42kbc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This function checks for &lt;code&gt;expires_in&lt;/code&gt; timestamp or our custom time &lt;em&gt;(before the token expires)&lt;/em&gt; and calls &lt;code&gt;reloadAuthResponse&lt;/code&gt; which is a util function provided by the library and it handles &lt;code&gt;refresh_token&lt;/code&gt; and obtains new &lt;code&gt;tokenId&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;And Yeah 😃 Google login is added to your application successfully 🎉. So now you can access the user's &lt;strong&gt;name, photo URL, email, google Id,&lt;/strong&gt; etc. &lt;/p&gt;

&lt;h2&gt;
  
  
  Additional
&lt;/h2&gt;

&lt;p&gt;The above way uses the Google Login default button. You can also use your custom button using &lt;code&gt;render&lt;/code&gt; prop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frbh2gg48dschpmaugg5d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frbh2gg48dschpmaugg5d.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also implement the same functionality using &lt;strong&gt;React Hooks.&lt;/strong&gt; ❤️&lt;/p&gt;

&lt;p&gt;&lt;code&gt;LoginHooks.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxgx3ires7pcywocdqyxu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxgx3ires7pcywocdqyxu.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;LogoutHooks.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe0apz4pgs42ssw4t41ky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe0apz4pgs42ssw4t41ky.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Server-side verification
&lt;/h2&gt;

&lt;p&gt;If you wish to add Server side verification, Send the &lt;code&gt;tokenId&lt;/code&gt; from client to server once &lt;code&gt;onSuccess&lt;/code&gt; in &lt;code&gt;Login&lt;/code&gt; component called.&lt;/p&gt;

&lt;p&gt;So while handling authenticated routes, All requests from the client need to send the &lt;code&gt;tokenId&lt;/code&gt; of the user in the header as &lt;strong&gt;Bearer token.&lt;/strong&gt; At Server, once token received it must be verified either this &lt;code&gt;tokenId&lt;/code&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;belongs to the current application.&lt;/li&gt;
&lt;li&gt;Has it expired&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can do them manually but google suggests using their authentication library &lt;em&gt;(Minimal effort required)&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;In the Server side &lt;em&gt;(Here Node.js is used).&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Install Google's official supported library &lt;code&gt;google-auth-library&lt;/code&gt; package which is used to authenticate and verify OAuth apps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0l6r82sapc8jbyzfg1ch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0l6r82sapc8jbyzfg1ch.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, With our &lt;code&gt;GOOGLE_CLIENT_ID&lt;/code&gt; sent it verifies whether this token belongs to our application or not. And it parses them and provides profile details in the &lt;code&gt;getPayload&lt;/code&gt; function. And you can use them to access user data.&lt;/p&gt;

&lt;p&gt;Any queries feel free to comment or chat with me personally in my social media accounts below. &lt;/p&gt;

&lt;p&gt;I love to be connected with developers. 😃 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/sivanesh_fiz" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; | &lt;a href="https://www.linkedin.com/in/sivanesh-shanmugam/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; | &lt;a href="https://github.com/Sivanesh-S" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>security</category>
      <category>webdev</category>
      <category>googlecloud</category>
    </item>
    <item>
      <title>A Minimalistic Web Portfolio for all devs 😎</title>
      <dc:creator>Sivanesh Shanmugam</dc:creator>
      <pubDate>Sun, 22 Mar 2020 10:15:51 +0000</pubDate>
      <link>https://dev.to/sivaneshs/a-minimalistic-web-portfolio-for-all-devs-37gh</link>
      <guid>https://dev.to/sivaneshs/a-minimalistic-web-portfolio-for-all-devs-37gh</guid>
      <description>&lt;p&gt;This is for developers who think&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"My work and code speak more than a Portfolio website"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A small &lt;strong&gt;minimal Portfolio&lt;/strong&gt; for developers who are tiring of thinking about creating their own new portfolio website. Due to the Pandemic outbreaks &lt;em&gt;(as staying at home)&lt;/em&gt;, I was thinking of creating a weekend fun project. While searching for ideas I came up with this. So that anyone can pull/fork this &lt;a href="https://github.com/Sivanesh-S/portfolio-minimal/"&gt;repo&lt;/a&gt; and use it to showcase their talents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NO WEB DEVELOPMENT SKILLS NEEDED&lt;/strong&gt; (If you do have, then can customize with your skills and ideas. 😄)&lt;/p&gt;

&lt;h2&gt;
  
  
  Responsive
&lt;/h2&gt;

&lt;p&gt;It is fully responsive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://sivanesh-s.github.io/portfolio-minimal/"&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Laptops
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NKhLcoCY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/Sivanesh-S/portfolio-minimal/master/README_DOCS/Lg.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NKhLcoCY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/Sivanesh-S/portfolio-minimal/master/README_DOCS/Lg.JPG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Tabs
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ueK71lJX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/Sivanesh-S/portfolio-minimal/raw/master/README_DOCS/md.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ueK71lJX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/Sivanesh-S/portfolio-minimal/raw/master/README_DOCS/md.JPG" width="500px"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Mobile
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Uvkkcleq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/Sivanesh-S/portfolio-minimal/raw/master/README_DOCS/sm.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Uvkkcleq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/Sivanesh-S/portfolio-minimal/raw/master/README_DOCS/sm.JPG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Data for the Portfolio
&lt;/h2&gt;

&lt;p&gt;You don't need to surf through HTML docs and update the data. All the data needed for your portfolio must be updated in &lt;code&gt;data.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GC6SJKBS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/Sivanesh-S/portfolio-minimal/raw/master/README_DOCS/Data.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GC6SJKBS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/Sivanesh-S/portfolio-minimal/raw/master/README_DOCS/Data.JPG"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>portfolio</category>
      <category>design</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
