<?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: Moin Akhter</title>
    <description>The latest articles on DEV Community by Moin Akhter (@moinakh22885547).</description>
    <link>https://dev.to/moinakh22885547</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%2F629264%2Fba73b384-b6de-49ae-b91b-704a1d2c42b9.jpg</url>
      <title>DEV Community: Moin Akhter</title>
      <link>https://dev.to/moinakh22885547</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moinakh22885547"/>
    <language>en</language>
    <item>
      <title>Passwordless Authentication with AWS Cognito: A Step-by-Step Guide</title>
      <dc:creator>Moin Akhter</dc:creator>
      <pubDate>Mon, 16 Dec 2024 21:45:16 +0000</pubDate>
      <link>https://dev.to/moinakh22885547/passwordless-authentication-with-aws-cognito-a-step-by-step-guide-379i</link>
      <guid>https://dev.to/moinakh22885547/passwordless-authentication-with-aws-cognito-a-step-by-step-guide-379i</guid>
      <description>&lt;p&gt;Passwordless authentication is becoming a popular way to authenticate users, offering both convenience and enhanced security. In this tutorial, you’ll learn how to implement passwordless authentication using AWS Cognito, complete with Lambda triggers for creating and verifying one-time passwords (OTPs).&lt;/p&gt;

&lt;p&gt;By the end of this tutorial, you’ll understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What passwordless authentication is&lt;/li&gt;
&lt;li&gt;How to configure it on AWS Cognito&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All code and related resources for this tutorial are available on this &lt;a href="https://github.com/MOIN-AKHTAR/aws-passwordless-cognito" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This tutorial follows the authentication flow illustrated in this &lt;a href="https://github.com/MOIN-AKHTAR/aws-passwordless-cognito/blob/main/docs/images/Passwordless-Flow.png" rel="noopener noreferrer"&gt;diagram&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Passwordless Authentication?
&lt;/h2&gt;

&lt;p&gt;Passwordless authentication eliminates the need for users to remember passwords, instead using alternatives like OTPs or links to authenticate. This approach not only reduces the risk of password theft but also enhances user convenience.&lt;/p&gt;

&lt;p&gt;Here’s how it works in the context of AWS Cognito:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A user enters their email or username on the login page.&lt;/li&gt;
&lt;li&gt;Cognito triggers Lambda functions to create a challenge (e.g., an OTP) and sends it to the user’s email.&lt;/li&gt;
&lt;li&gt;The user provides the OTP, which Cognito verifies.&lt;/li&gt;
&lt;li&gt;Upon successful verification, Cognito returns tokens (access, refresh, and ID tokens) to authenticate the user.&lt;/li&gt;
&lt;li&gt;Although the concept is simple, setting up this flow requires careful configuration of AWS Cognito and Lambda triggers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;To follow this tutorial, ensure you have:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An AWS Cognito User Pool:&lt;/strong&gt; With an associated App Client configured for custom authentication.&lt;br&gt;
&lt;strong&gt;An IAM User:&lt;/strong&gt; With permissions to manage Cognito via the AWS SDK.&lt;br&gt;
Here’s an example of an IAM policy with the required permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "cognito-idp:*",
            "Resource": "RESOURCE_ARN"
        }
    ]
}

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Lambda Triggers Overview
&lt;/h2&gt;

&lt;p&gt;Passwordless authentication in AWS Cognito relies on three key Lambda triggers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DEFINE_AUTH_CHALLENGE:&lt;/strong&gt; Determines the type of challenge (e.g., OTP) and handles retry limits.&lt;br&gt;
&lt;strong&gt;CREATE_AUTH_CHALLENGE:&lt;/strong&gt; Creates the challenge (e.g., generates and sends an OTP).&lt;br&gt;
&lt;strong&gt;VERIFY_AUTH_CHALLENGE:&lt;/strong&gt; Verifies the user’s response to the challenge.&lt;br&gt;
These triggers work together to implement the passwordless authentication flow.&lt;/p&gt;
&lt;h2&gt;
  
  
  Implementing Lambda Triggers
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. DEFINE_AUTH_CHALLENGE
&lt;/h3&gt;

&lt;p&gt;This trigger determines the authentication flow logic, such as whether to issue tokens or present the next challenge.&lt;/p&gt;

&lt;p&gt;Here’s a sample implementation for allowing up to 3 OTP attempts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exports.handler = async (event) =&amp;gt; {
  const { session } = event.request;
  const lastChallenge = session?.slice(-1)?.[0];

  if (lastChallenge?.challengeResult) {
    // User successfully authenticated
    event.response.issueTokens = true;
    event.response.failAuthentication = false;
  } else if (session?.length &amp;gt;= 3 &amp;amp;&amp;amp; !lastChallenge?.challengeResult) {
    // User failed too many attempts
    event.response.issueTokens = false;
    event.response.failAuthentication = true;
  } else {
    // Present next challenge
    event.response.issueTokens = false;
    event.response.failAuthentication = false;
    event.response.challengeName = 'CUSTOM_CHALLENGE';
  }

  return event;
};

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. CREATE_AUTH_CHALLENGE
&lt;/h3&gt;

&lt;p&gt;This trigger generates an OTP and sends it to the user via email.&lt;/p&gt;

&lt;p&gt;Here’s a sample implementation using Amazon SES:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { SESClient, SendEmailCommand } = require('@aws-sdk/client-ses');
const ses = new SESClient();

exports.handler = async (event) =&amp;gt; {
  const userEmail = event.userName;
  if (!userEmail) throw new Error('Missing email');

  let otpCode = Math.floor(100000 + Math.random() * 900000); // 6-digit OTP
  await sendEmail(userEmail, otpCode);

  event.response.privateChallengeParameters = { secretLoginCode: otpCode };
  event.response.publicChallengeParameters = { email: userEmail };

  return event;
};

async function sendEmail(emailAddress, otpCode) {
  const command = new SendEmailCommand({
    Destination: { ToAddresses: [emailAddress] },
    Message: {
      Subject: { Data: 'Your One-Time Login Code' },
      Body: { Html: { Data: `&amp;lt;p&amp;gt;Your login code is: &amp;lt;strong&amp;gt;${otpCode}&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;` } }
    },
    Source: process.env.MAIL_FROM
  });

  await ses.send(command);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Ensure the Lambda role has &lt;code&gt;ses:SendEmail&lt;/code&gt; permissions.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. VERIFY_AUTH_CHALLENGE
&lt;/h3&gt;

&lt;p&gt;This trigger validates the OTP entered by the user.&lt;/p&gt;

&lt;p&gt;Here’s a simple implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exports.handler = async (event) =&amp;gt; {
  const expectedOtp = event.request.privateChallengeParameters.secretLoginCode;
  const providedOtp = event.request.challengeAnswer;

  event.response.answerCorrect = providedOtp === expectedOtp;
  return event;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configuring Triggers in Cognito
&lt;/h2&gt;

&lt;p&gt;After deploying the Lambda functions, link them to your Cognito User Pool:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the Triggers section of your User Pool.&lt;/li&gt;
&lt;li&gt;Assign the Lambda functions to their respective triggers:

&lt;ul&gt;
&lt;li&gt;Define auth challenge → DEFINE_AUTH_CHALLENGE&lt;/li&gt;
&lt;li&gt;Create auth challenge → CREATE_AUTH_CHALLENGE&lt;/li&gt;
&lt;li&gt;Verify auth challenge → VERIFY_AUTH_CHALLENGE&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Backend API Implementation
&lt;/h2&gt;

&lt;p&gt;Once Cognito is configured, create two backend endpoints to handle authentication.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Initiating Authentication
&lt;/h3&gt;

&lt;p&gt;This endpoint starts the custom authentication flow by invoking the&lt;code&gt;CUSTOM_AUTH&lt;/code&gt; action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { InitiateAuthCommand } = require('@aws-sdk/client-cognito-identity-provider');

const initiateAuth = async (userName) =&amp;gt; {
  const command = new InitiateAuthCommand({
    AuthFlow: 'CUSTOM_AUTH',
    ClientId: process.env.AWS_COGNITO_APP_CLIENT,
    AuthParameters: { USERNAME: userName }
  });

  const response = await cognitoClient.send(command);
  return response.Session; // Save this session for verification
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Verifying the OTP
&lt;/h3&gt;

&lt;p&gt;This endpoint verifies the OTP provided by the user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { RespondToAuthChallengeCommand } = require('@aws-sdk/client-cognito-identity-provider');

const verifyOtp = async (session, userName, otp) =&amp;gt; {
  const command = new RespondToAuthChallengeCommand({
    ChallengeName: 'CUSTOM_CHALLENGE',
    ClientId: process.env.AWS_COGNITO_APP_CLIENT,
    Session: session,
    ChallengeResponses: { USERNAME: userName, ANSWER: otp }
  });

  const response = await cognitoClient.send(command);
  return response.AuthenticationResult; // Contains tokens on success
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With this setup, you’ve successfully implemented passwordless authentication using AWS Cognito. This method enhances both security and user experience by eliminating passwords. For a complete implementation, visit the &lt;a href="https://github.com/MOIN-AKHTAR/aws-passwordless-cognito" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to leave a comment if you have questions or suggestions!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>CloudFront Caching for AWS S3 Objects</title>
      <dc:creator>Moin Akhter</dc:creator>
      <pubDate>Tue, 07 Nov 2023 21:51:14 +0000</pubDate>
      <link>https://dev.to/moinakh22885547/cloudfront-caching-for-aws-s3-objects-53g6</link>
      <guid>https://dev.to/moinakh22885547/cloudfront-caching-for-aws-s3-objects-53g6</guid>
      <description>&lt;p&gt;In this blog, we will learn about caching s3 objects by using another AWS service called Cloudfront.&lt;/p&gt;

&lt;p&gt;Storing images and files on s3 is a very common and cost-effective solution. But cost-effectiveness is not everything but the performance of the object that your client accessing does also matter. Now by default, AWS uses very good approaches to give back your object (In the S3 world any file or image that you upload on it is an object). Now we can also optimize by caching the most frequently accessed object on CDN servers managed by AWS. Now for this purpose, AWS gives us another service called Cloud Front.&lt;/p&gt;

&lt;p&gt;Now let's see how we can create an s3 bucket and use Cloud Front in order to cache our objects.&lt;/p&gt;

&lt;h2&gt;
  
  
  CREATE YOU BUCKET FIRST:-
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to s3.&lt;/li&gt;
&lt;li&gt;Click on Create Bucket.&lt;/li&gt;
&lt;li&gt;Give an appropriate name for your bucket.&lt;/li&gt;
&lt;li&gt;Leave your bucket as private as we will use cloud front in order to get objects.&lt;/li&gt;
&lt;li&gt;Enable version if you want versioning.&lt;/li&gt;
&lt;li&gt;Then click on the Create Bucket button.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  CREATE A CLOUD FRONT FOR CACHING PURPOSE:-
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to cloud front service.&lt;/li&gt;
&lt;li&gt;Click on Create Distribution.&lt;/li&gt;
&lt;li&gt;For the Origin domain select the bucket name for which you want to add this distribution.&lt;/li&gt;
&lt;li&gt;For Origin access select Origin access control settings (recommended). A dropdown will appear click on create access control setting button. Select recommended for Signing behavior and also check the do not override header check box, select origin type as s3, and click create.&lt;/li&gt;
&lt;li&gt;For Web Application Firewall (WAF) select Enable Security Protection for security purposes.&lt;/li&gt;
&lt;li&gt;For the Default root object use any default image name that will be shown when you hit the base URL of this distribution.&lt;/li&gt;
&lt;li&gt;Click on the Create and Copy policy. We will attach this policy to the s3 bucket which will block everyone from accessing objects of the bucket and only allow this distribution to access s3 objects on behalf of the user which is a kind of an extra layer of security.&lt;/li&gt;
&lt;li&gt;Go to your intended bucket and in the Permissions tab go to Bucket Policy paste the copied policy of Cloud Front distribution there and click on save changes.&lt;/li&gt;
&lt;li&gt;Now upload an image with the same name and extension that you set for the Default root object while creating the cloud front distribution. Now go to your cloud front distribution and go to the General tab. In general tab you will be able to see the Distribution domain name. Copy this Distribution domain name and hit on your browser you will be able to see the Default root object on the base URL. That's it now you can access your objects on "distributionUrl/objectName". Object will also be cached on some CDN server by aws so whenever you access this file aws will give you back the cached file in order to decrease latency.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>s3</category>
      <category>cloudfront</category>
      <category>aws</category>
    </item>
    <item>
      <title>Deploying Nodejs App To Heroku</title>
      <dc:creator>Moin Akhter</dc:creator>
      <pubDate>Fri, 18 Aug 2023 18:51:19 +0000</pubDate>
      <link>https://dev.to/moinakh22885547/deploying-nodejs-app-to-heroku-3dlo</link>
      <guid>https://dev.to/moinakh22885547/deploying-nodejs-app-to-heroku-3dlo</guid>
      <description>&lt;p&gt;In this blog we will learn how we can deploy our nodejs app on heroku.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Goals&lt;/strong&gt;&lt;br&gt;
We will try to deploy our nodejs app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
You just need to have a heroku account.&lt;/p&gt;

&lt;p&gt;Deployment is one of the difficult part for developer.But, heroku made it very easy just few commands and your app deployed.In this blog i will teach you how we can easily deployed our nodejs app on heroku.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;How To Deploy On Heroku.&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First of all login to your heroku account and create an app.&lt;/li&gt;
&lt;li&gt;While creating app heroku will ask for buildpack which use to build your nodejs app code for nodejs we can select nodejs.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Now donwload heroku-cli for your system.You can download from here &lt;a href="https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli"&gt;https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Initialize your repo with nodejs app.&lt;/li&gt;
&lt;li&gt;After downloading heroku-cli login to your heroku account.For that you can use this command.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It will take you to browser to login your account.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After login add heroku origin.Be remember heroku also uses a git repo on their linux system/machine inorder to store your code after storing into it's repo it will use buildpack to build your code and generate minimized and more compressed version of your code to make it more efficient and faster than make it available to all over the world.You can find heroku remote origin on settings tab.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HexndxdJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd1jhdvsu3kux7m0d1zd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HexndxdJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd1jhdvsu3kux7m0d1zd.png" alt="Image description" width="800" height="243"&gt;&lt;/a&gt;&lt;br&gt;
You can add heroku origin by using this command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add remote heroku https://git.heroku.com/&amp;lt;your_app_name&amp;gt;.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here i set heroku origin name as heroku you can also provide any intended name to your heroku origin.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After adding heroku origin add your files to staging area and  commit your files and than push to heroku origin using this command.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push heroku &amp;lt;your_branch_name&amp;gt;:main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above command will not push code to your vcs repo but only heroku's repo.&lt;br&gt;
After that you can also push code to you git repo as well.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Once code pushed successfully on heroku origin heroku will start building your app and than deploy your app at the end of logs you will get a deployed url.You can use this url inorder to check whether you app deployed successfully or not.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To see logs you can use this command.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku logs --tail
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;NOTE:-&lt;/strong&gt;&lt;br&gt;
       Heroku by default uses main branch to deploy your code from where it should copy code you specifiy like in below command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push heroku &amp;lt;branch_from_where_to_copy_code&amp;gt;:main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more detail you can visit &lt;a href="https://devcenter.heroku.com/articles/git"&gt;https://devcenter.heroku.com/articles/git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it, happy coding😉.&lt;/p&gt;

</description>
      <category>node</category>
      <category>heroku</category>
    </item>
    <item>
      <title>Creating event on google calander with google meet link.</title>
      <dc:creator>Moin Akhter</dc:creator>
      <pubDate>Sat, 05 Aug 2023 15:06:11 +0000</pubDate>
      <link>https://dev.to/moinakh22885547/creating-event-on-google-calander-with-google-meet-link-2na5</link>
      <guid>https://dev.to/moinakh22885547/creating-event-on-google-calander-with-google-meet-link-2na5</guid>
      <description>&lt;p&gt;In this tutorial, we will learn about how to create event on google calander with google meet link.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Goals&lt;/strong&gt;&lt;br&gt;
By the end of this blog you will have idea about:&lt;br&gt;
How to create event on google calander.&lt;br&gt;
How to inject google meet link as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You must have knowledge about javascript,nodejs and a little bit idea how does google calander apis works.&lt;/li&gt;
&lt;li&gt;You must have google admin account (We need some advance feature which can't be available in regular google account).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All code will be available on this link.&lt;br&gt;
&lt;a href="https://github.com/MOIN-AKHTAR/google-calander-event-with-meet-link"&gt;https://github.com/MOIN-AKHTAR/google-calander-event-with-meet-link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So before starting first login you google admin account as google developer account and create your project.You can create project by following these steps.&lt;/p&gt;

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

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

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

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

&lt;p&gt;After you have created project you have to enables Google Calander APIS.You can enable by following these steps.&lt;/p&gt;

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

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

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

&lt;p&gt;After you have enabled calander apis now you need to create a service account.json so that we can use that on our backend as authenticated machine/user.You can create service-account.json by following these steps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ixY4TSGW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wwid5w36nziyjm0i4j5t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ixY4TSGW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wwid5w36nziyjm0i4j5t.png" alt="Image description" width="800" height="268"&gt;&lt;/a&gt;&lt;br&gt;
After clicking on service account you will see below screen fill all necessary information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dAhkwR6Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ootf7krabryizvrqkkeh.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dAhkwR6Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ootf7krabryizvrqkkeh.PNG" alt="Image description" width="800" height="630"&gt;&lt;/a&gt;&lt;br&gt;
After you fill all necessary info and click on done you will be redirected to a page where there will be three sections API Keys,OAuth 2.0 Client IDs and Service Accounts.Select you service-account which you have just created and go to Keys click on ADD KEY button and create this will create and download a service-account.json in your machine save this for use in our backend code.&lt;/p&gt;

&lt;p&gt;Now after created and downloaded service-account.json file copy client_id which is in your service-account.json.Than go to google admin console and login your google admin account and follow these steps.&lt;/p&gt;

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

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

&lt;p&gt;In above pop up image paste your client_id which you coppied from downloaded service-account.json and add &lt;strong&gt;&lt;a href="https://www.googleapis.com/auth/calendar"&gt;https://www.googleapis.com/auth/calendar&lt;/a&gt;&lt;/strong&gt; as scope in above image.&lt;/p&gt;

&lt;p&gt;That's it that was full configuration part now let's go to coding part.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;google-auth-library [For authentication purpose].
@googleapis/calendar [For calander apis purpose].
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In code i have created a createEvent function inwhich we configure everything which will create event on google calander og participants and google admin account.In this function we just authenticating ourself via service-account.json properties and than creating event with all basic info like title,description,start and endtime with participants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SUMMARY:-&lt;/strong&gt;&lt;br&gt;
       In summary what we have done first of all we created a project on google developer conolse using google admin account,enabled calander api and than created and downloaded service-account.json in our machine.After all this we log in to google admin console using google admin creds and added our service-account.json's client_id as domain wide delegation.On our backend we created a createEvent function which creating calander event and also google meet link with it.That's it happy coding...&lt;/p&gt;

</description>
      <category>node</category>
      <category>calander</category>
      <category>googlemeet</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Creating appointment and sync with google calander.</title>
      <dc:creator>Moin Akhter</dc:creator>
      <pubDate>Thu, 27 Jul 2023 18:47:16 +0000</pubDate>
      <link>https://dev.to/moinakh22885547/creating-appointment-and-sync-with-google-calander-1npn</link>
      <guid>https://dev.to/moinakh22885547/creating-appointment-and-sync-with-google-calander-1npn</guid>
      <description>&lt;p&gt;In this tutorial, we will learn about how to oauth via google,schedule appointment and sync appointment with our google calander.&lt;/p&gt;

&lt;h2&gt;
  
  
  Goals
&lt;/h2&gt;

&lt;p&gt;By the end of this blog you will have idea about:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to oauth with google.&lt;/li&gt;
&lt;li&gt;How to schedule appointment using onsched service.&lt;/li&gt;
&lt;li&gt;How to sync our appointment with google calander.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You must have knowledge about javascript,nodejs and a little bit idea how does google oauth works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Techs
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Mongodb (For storing records like user,appointments,services).&lt;/li&gt;
&lt;li&gt;Redis (For storing google's tokens i.e. refresh and access token).&lt;/li&gt;
&lt;li&gt;Onsched (For appointment)&lt;/li&gt;
&lt;li&gt;Google developer console project with enabled people and calander services and gogole oauth.&lt;/li&gt;
&lt;li&gt;Reactjs &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All code will be available on this link.&lt;br&gt;
&lt;a href="https://github.com/MOIN-AKHTAR/onSched-Implementation"&gt;https://github.com/MOIN-AKHTAR/onSched-Implementation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Working with timezones and creating appointment is a kind of a pain for devs if you have experienced with these kind of scnerios you must know how its difficult to deal with,now not anymore there are plenty of services you can use like calcom,nylas and onsched.In this blog i will guide you how we can use onsched service inorder to overcome all these availability and timezones issue if you are intending to create an appointment type of web/app.&lt;br&gt;
Before go a little bit more in depth i want to discuss few thing which make it easier to understand upcoming things.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does onsched work?&lt;/strong&gt;&lt;br&gt;
If you got idea about this question you will be able to understand overall flow, basically there are four core concepts which onsched uses behind the scene.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Location&lt;/li&gt;
&lt;li&gt;Resource&lt;/li&gt;
&lt;li&gt;Service&lt;/li&gt;
&lt;li&gt;Customer&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Location:-
&lt;/h2&gt;

&lt;p&gt;Location is the main object whenever you create an onsched account you must create a location and inside this location you have to set business hours.&lt;br&gt;
Onsched takes these working hours inorder to provide availability of resource and services.Now resources and services also have their own availability but if their availability goes beyond the boundary of location working hour you will not get any resource or service available for making appointment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resource:-
&lt;/h2&gt;

&lt;p&gt;A resource is nothing but a person with whom you want to make an appointment.Let's say you want to make an appointment with a doctor here doctor is a resource for onsched.While creating a resource you set their availability as well but in my code i have made it available for all days 24hrs you can set that via availability property while creating resource.&lt;/p&gt;

&lt;h2&gt;
  
  
  Service:-
&lt;/h2&gt;

&lt;p&gt;A service is self explanatory let's say a doctor can provide service for psychopath,geocologist and plastic surgeon so these are services for onsched.Each service also have availability while creating service but in my code i have made it available for all days 24hrs you can set that via availability property while creating servce.&lt;/p&gt;

&lt;h2&gt;
  
  
  Customer:-
&lt;/h2&gt;

&lt;p&gt;A customer is nothing but a person who is making appointment with a particular resource for a specific service for a specifc dates time slot.While creating appointment we are making onsched customer as well.&lt;/p&gt;

&lt;p&gt;These above terms seems to be kind of difficult to understand but these concepts which onsched uses behind the scene.&lt;/p&gt;

&lt;p&gt;Ok, now let's move to the practical part instead of theoritical part.&lt;/p&gt;

&lt;p&gt;First of all we need to use google services like people and calander so create a project on google developer console and enable services like People API and Google Calendar API.You can enable by following these steps.&lt;/p&gt;

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

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

&lt;p&gt;We are using google oauth so for that we need to create CLIENT_ID and CLIENT_SECRET you can generate by following these steps.&lt;/p&gt;

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

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

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

&lt;p&gt;Since we will use onsched service for scheduling and appointment purpose also create account on onsched and set business hours of primary location you can do this by following these steps.&lt;/p&gt;

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

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

&lt;p&gt;To use onsched apis on our backend we gonna need CLIENTID and CLIENT_SECRET.You can get these by following these steps.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  &lt;strong&gt;HOW DOES AVAILABILITY WORKS:-&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So on onsched availability depends on availability of locations's busniess hours,service availability and resource availability.&lt;br&gt;
                                                  So, in simple we can say that onsched takes a kind of intersection among these three objects (Location,Resource and Service) availability and convert according to your timezone.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;NOW HOW CODE WORKS HERE:&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  HOW LOGIN WORKING:-
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Initially you will get a login page when you click on &lt;strong&gt;Login With Google&lt;/strong&gt; you will be redirected to oauth screen.After you entered correct creds you will be asked for permission of your calander so that we can add or remove any sort of event in your calander.In response you will be redirected to redirect screen which you setted up in oauth conscent screen setting. In simple you will be redirected to url like &lt;a href="http://localhost:30000/?code=someCodeGivenByGoogle"&gt;http://localhost:30000/?code=someCodeGivenByGoogle&lt;/a&gt;.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I_fdu6wG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4j5xy1yptoaw2bvsnruq.PNG" alt="Image description" width="441" height="188"&gt;
&lt;/li&gt;
&lt;li&gt;We than sending this code on our backend on /auth/tokens endpoint and getting access and refresh token from google and savig these tokens in redis so that we can use these tokens inorder to create event.Because for any event to be created on your calander we need to be authorized and those tokens which we saved in redis is a sign that we are authorized we will attatch these tokens when we will create any event to make us to be authorized for using google calander apis.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  CREATING APPOINTMENT:-
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;After login you will be redirected to /dashboard screen where you i'll be able to see list of resources.&lt;/li&gt;
&lt;li&gt;By clicking on view service you will be able to see a list of all services realted to that particular resource.&lt;/li&gt;
&lt;li&gt;By clicking on create appointment a calander will be appear in front of you.&lt;/li&gt;
&lt;li&gt;To create appointment you first need to select date on clicking date you will get a list of time slot available for that particular date.&lt;/li&gt;
&lt;li&gt;By clicking on a specific time slot you will create appointment and this appointment will be available on /appointments route.&lt;/li&gt;
&lt;li&gt;On /appointments route you will be able to see list of your appointment by clicking on go to call button it will redirect you to google meet where you can talk shalk that's it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;SUMMARY:-&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In simple by using onsched we create location,resource and services and each object have there availability.To make availability according to you timezone we provide timezoneId,resourceId and serviceId.Onsched will do all heavy lifting behind the scene for you and give us availability and than by clicking any suitable time slot we have created our appointment while creating appointment we are creating customer and than appointment and this appontment become available to our calander as we are using oauth and also saving access and refresh token provided by google.That's it...&lt;/p&gt;

</description>
      <category>node</category>
      <category>react</category>
      <category>javascript</category>
      <category>google</category>
    </item>
    <item>
      <title>Creating a stripe connect account.</title>
      <dc:creator>Moin Akhter</dc:creator>
      <pubDate>Wed, 31 May 2023 22:40:33 +0000</pubDate>
      <link>https://dev.to/moinakh22885547/creating-a-stripe-connect-account-235d</link>
      <guid>https://dev.to/moinakh22885547/creating-a-stripe-connect-account-235d</guid>
      <description>&lt;p&gt;In this tutorial, we will learn about how to create stripe connect account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Goals
&lt;/h2&gt;

&lt;p&gt;By the end of this tutorial, you knew about:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is stripe connect account.&lt;/li&gt;
&lt;li&gt;When we should use.&lt;/li&gt;
&lt;li&gt;How to create stripe connect account.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You must have knowledge about javascript and nodejs for this.&lt;/p&gt;

&lt;p&gt;All code will be available on this link.&lt;br&gt;
&lt;a href="https://github.com/MOIN-AKHTAR/stripe-connect.git" rel="noopener noreferrer"&gt;https://github.com/MOIN-AKHTAR/stripe-connect.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last time i was working on a backend and the application was like we have advisros and those advisors can give advices and customer can pay to advisor for their services.Now for collecting payment we have multiple payment gateways like stripe,paypal and much more but stripe is more reliable and recomended because it provides multiple ways of collecting payment and make easier for developers to deal with these scnerios.Now stripe provides multiple ways to collect payment now for my scnerio i have used a feature called stripe connect.&lt;/p&gt;

&lt;p&gt;Now what's this stripe connect account.In simple words you can think of as a stripe account which will collect money on others behalf in our scnerio advisors.Now for each of my advisors i have created a stripe connect so that we can put payment to their account.&lt;/p&gt;

&lt;p&gt;But before of that make sure you set up a business in your platform stripe account(mean account who's secret key you are using).You can set by going to this link.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://dashboard.stripe.com/login?redirect=%2Fsettings%2Fconnect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now follow these step to setup your business.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to branding section.&lt;/li&gt;
&lt;li&gt;Set business name&lt;/li&gt;
&lt;li&gt;Than go to Appearance section.&lt;/li&gt;
&lt;li&gt;Set icon,logo,brand color and accent color and than click on save branding changes button which will next to "Branding Section Heading".
After all steps you may see this type of result.&lt;/li&gt;
&lt;/ol&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%2Fuploads%2Farticles%2Fnfukplocn3oydif768g1.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%2Fuploads%2Farticles%2Fnfukplocn3oydif768g1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now aftre setting up business first we need a secret key of stripe platform account you can create your account on stripe and use test or live keys for this purpose.&lt;/p&gt;

&lt;p&gt;To get secret key you can go to Home tab and there you can find keys.&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%2Fuploads%2Farticles%2F1x25vbg2ox1guq6w5szs.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%2Fuploads%2Farticles%2F1x25vbg2ox1guq6w5szs.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For creating stripe connect account we need to create a url which will redirect you to a prebuilt form of stripe where you have to provide all necessary information about your business,personal information and bank account info which stripe will use to payout.&lt;/p&gt;

&lt;h2&gt;
  
  
  BACKEND PART:
&lt;/h2&gt;

&lt;p&gt;Before starting our backend we have to install few dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. express (For setting up our server).
2. dotenv (To read environment variables from .env file).
3. cors (To resolve cors issue).
4. stripe (To deal with stripe related tasks).
5. nodemon (Install as dev dependency it will auto restart your 
            server whenever any changes occur in your code).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now this piece of code will create that url which will redirect you to prebuilt from provided by stripe for collecting necessary info.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const account = await stripe.accounts.create({
        type: 'standard',
      });
const accountLinks = await stripe.accountLinks.create({
        account: account.id,
        refresh_url: `${process.env.ORIGIN}/verify-wallet?account_id=${account.id}`,
        return_url: `${process.env.ORIGIN}/verify-wallet?account_id=${account.id}`,
        type: 'account_onboarding',
      });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you will redirect to url you will see this kind of screen.&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%2Fuploads%2Farticles%2Fx14767uru8pc98f0b4it.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%2Fuploads%2Farticles%2Fx14767uru8pc98f0b4it.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we also have used &lt;strong&gt;ORIGIN&lt;/strong&gt; this origin is nothing but your web page such as &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; stripe will redirect you to this page with accountId as we set in refresh_url and return_url.So, you can do some sort of action on this page like we can check whether user has provided all info which stripe was expecting and than save this accountId to database.&lt;/p&gt;

&lt;p&gt;After all this setup if all required info provided to stripe so we can pay to this account using stripe charge api for that you can visit to &lt;a href="https://stripe.com/docs/api/charges/create" rel="noopener noreferrer"&gt;https://stripe.com/docs/api/charges/create&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>stripe</category>
    </item>
    <item>
      <title>Gcp Resumable Upload With Reactjs And Nodejs</title>
      <dc:creator>Moin Akhter</dc:creator>
      <pubDate>Sun, 13 Nov 2022 10:09:34 +0000</pubDate>
      <link>https://dev.to/moinakh22885547/gcp-resumable-upload-with-reactjs-and-nodejs-1dd1</link>
      <guid>https://dev.to/moinakh22885547/gcp-resumable-upload-with-reactjs-and-nodejs-1dd1</guid>
      <description>&lt;p&gt;In this tutorial, we will learn about resumable upload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Goals
&lt;/h2&gt;

&lt;p&gt;By the end of this tutorial, you’ll know:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating GCP Bucket.&lt;/li&gt;
&lt;li&gt;How to upload large files resumable.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You must have knowledge about javascript and nodejs for this.&lt;/p&gt;

&lt;p&gt;Now a day users upload a large file to buckets. Now during uploading, if any error occurs, the user must upload that large file again, which can be irritating for the user.This is where resumable upload comes in to picture.Many service providers like gcp and aws gives ability of resumably upload large files into chunk using something called "signedUrl".&lt;/p&gt;

&lt;p&gt;A signedUrl is a kind of url which is valid for a restricted time after that this url will be discard automatically by service provider.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;All code will be available on this link.&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/MOIN-AKHTAR/Resumable-Upload-To-GCP" rel="noopener noreferrer"&gt;https://github.com/MOIN-AKHTAR/Resumable-Upload-To-GCP&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  BACKEND PART:
&lt;/h2&gt;

&lt;p&gt;Before starting our backend we have to install few dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. express (For setting up our server).
2. dotenv (To read environment variables from .env file).
3. cors (To resolve cors issue).
4. @google-cloud/storage (This sdk will help us to work with gcp 
                          bucket).
5. nodemon (Install as dev dependency it will auto restart your 
            server whenever any changes occur in your code).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inorder to work with gcp bucket first you have to create a bucket inside a project.So go to &lt;a href="https://console.cloud.google.com/" rel="noopener noreferrer"&gt;https://console.cloud.google.com/&lt;/a&gt; and create a new project.&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%2Fuploads%2Farticles%2Fpf9surrqhni8mf4nwo4k.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%2Fuploads%2Farticles%2Fpf9surrqhni8mf4nwo4k.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now follow the steps which i have shown in above image after step 3 you will be redirect to another screen which will ask you above service account details fill the details appropriately than submit the form.After submitting you will get a list of service accounts.&lt;br&gt;
Click on intended service account and go to keys tab than click on Add Key button and download json file.&lt;br&gt;
                                    Now, this file will be used as secret for authentication and to verify whcih account of google developer console you are using.&lt;/p&gt;

&lt;p&gt;After that we need to create a bucket for our this newly created project.For creating new bucket follow steps shown in below snapshot.&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%2Fuploads%2Farticles%2F2i2h6jqkpfm4bc7fz7yy.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%2Fuploads%2Farticles%2F2i2h6jqkpfm4bc7fz7yy.PNG" alt="Image description"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;After following above steps click on create bucket button.Give some name to your bucket.After creating you gcp bucket you will be redirect to a page where you i'll be able to see a list of buckets you slected project have. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:-&lt;/strong&gt; Inorder to get access to uploaded files i have made my bucket as public you can set persmission for your bucket suits your scenario.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cloud.google.com/storage/docs/access-control/making-data-public" rel="noopener noreferrer"&gt;https://cloud.google.com/storage/docs/access-control/making-data-public&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inorder to upload files we need to configure our cors config for resumable upload for bucket.These cors config is basically for security purposes.You can follow below code to config your bucket cors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { Storage } = require("@google-cloud/storage");

const storage = new Storage({
  keyFilename: "google-storage-key.json",
});

async function configureBucketCors() {
  const [metadata] = await storage
    .bucket(process.env.BUCKET_NAME)
    .getMetadata();
  if (!metadata.cors) {
    await storage.bucket(process.env.BUCKET_NAME).setCorsConfiguration([
      {
        origin: [process.env.OTHER_ORIGIN], //Such as 
 http://localhost:3000
        responseHeader: [
          "Content-Type",
          "Access-Control-Allow-Origin",
          "X-Upload-Content-Length",
          "X-Goog-Resumable",
        ],
        method: ["PUT", "OPTIONS", "POST"],
        maxAgeSeconds: 3600,
      },
    ]);
  }
}

configureBucketCors().catch(console.error);

exports.storage = storage;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now in above code snippest you must keep responseHeader &amp;amp;&amp;amp; method as it is other wise it will not work because these responseHeader and methods are necessary in config.&lt;/p&gt;

&lt;p&gt;After this config we need to create an endpoint which will give us a signedUrl which we can use on front end to resumably upload files to ou configured bucket.Now below code snippest is doing that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.route("/getSignedUrl").get(async (req, res, next) =&amp;gt; {
  try {
    const [url] = await storage
      .bucket(process.env.BUCKET_NAME)
      .file(req.query.fileName)
      .getSignedUrl({
        action: "resumable",
        version: "v4",
        expires: Date.now() + 12 * 60 * 60 * 1000,
        contentType: "application/octet-stream",
      });
    return res.json({
      url,
    });
  } catch (error) {
    return res.status(500).json({
      success: false,
      error,
    });
  }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  FRONTEND PART:-
&lt;/h2&gt;

&lt;p&gt;Now in front end part i'm not going to deep just giving idea what's we are doing on front end.So here what we have done on front end.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First we added an input which will pick file.&lt;/li&gt;
&lt;li&gt;After we selected file we hit our enpoint which will give us a signedUrl.&lt;/li&gt;
&lt;li&gt;Using this signed url we will get a session url.&lt;/li&gt;
&lt;li&gt;This session url will be used to upload file resumably.&lt;/li&gt;
&lt;li&gt;For that i have created a function postNotificationService.This will upload file chunk using session url.&lt;/li&gt;
&lt;li&gt;Whenever chunk uploaded successfully we will get a status of 308 which mean that chunk uploaded to bucket successfully but some chunk of file are still remaining.So we have called postNotificationService function recursively.&lt;/li&gt;
&lt;li&gt;When whole file will be uploaded successfully we will get status code of 200 and url of uploaded file will be in data.request.responseURL.split("?")[0].&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it..&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s Recap
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;We learned about what is resumable upload.&lt;/li&gt;
&lt;li&gt;What are signedUrl.&lt;/li&gt;
&lt;li&gt;Created Google project and also created bucket.&lt;/li&gt;
&lt;li&gt;We configured cors for bucket which we will use for resumable 
upload.&lt;/li&gt;
&lt;li&gt;Created an endpoint which will generate a signedUrl which we 
can use on frontend to resumably upload file to bucket.&lt;/li&gt;
&lt;li&gt;On front end we hit signedUrl to get signedUrl.&lt;/li&gt;
&lt;li&gt;Using this signedUrl we got session url.&lt;/li&gt;
&lt;li&gt;We used session url for resumable upload.&lt;/li&gt;
&lt;li&gt;We uploaded file chunk by chunk using session url.&lt;/li&gt;
&lt;li&gt;Whenever chunk uploaded successfully and we got status of 308 it's mean that chunk of file uploaded successfully but not the whole uploaded yet.&lt;/li&gt;
&lt;li&gt;If we got status code of 200 it's mean whole file uploaded to bucket successfully.&lt;/li&gt;
&lt;li&gt;Than data.request.responseURL.split("?")[0] we will get url of whole uploaded file.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>node</category>
      <category>gcp</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
