OTP  Verification system Complete Project Free Download

In this blog post, we will guide you through the process of setting up two-step verification for your Gmail account, generating an app password, and using that app password to send OTP (One-Time Password) emails via PHP. This tutorial will ensure the security of your Gmail account while allowing you to integrate a secure OTP system for your web application.

Step 1: Log in to Your Gmail Account

The first step is to log in to your Gmail account. Simply go to Gmail and enter your username and password.

Step 2: Manage Your Google Account

Once you're logged in, click on your profile icon in the top right corner of the Gmail page. From the drop-down menu, select Manage your Google Account. This will open the Google Account management page.

Step 3: Enable Two-Step Verification

  1. On the Google Account management page, navigate to the Security tab on the left sidebar.
  2. Under the "Signing in to Google" section, click on 2-Step Verification.
  3. Click Get Started and follow the prompts to set up two-step verification. Google will ask you to verify your phone number, after which you can choose your preferred second layer of security, such as a text message or an authenticator app.

Step 4: Create an App Password

Search App password on search bar





Once two-step verification is enabled, you’ll need to create an app password for your Gmail account. This password will allow you to authenticate and send emails from your server without needing to enter your actual Gmail password.

  1. Go back to the Security tab in your Google Account settings.
  2. Scroll down to App passwords under the "Signing in to Google" section.
  3. Google may ask you to sign in again. Once logged in, select the app (for example, Mail) and the device (choose Other and input a name like PHP App).
  4. Click Generate. Google will display a 16-character password. Copy this password.

Step 5: Set Up the PHP Code to Send OTP




Download Source code



Now that you have the app password, we can move on to setting up the PHP code to send OTP emails. Before that, let’s create the database that will store user data and OTP details.

Step 5.1: Create a Database and Table for OTP
Download Database

We’ll create a database named sent_otp and a table otp_details to store the OTP information. You can use the following SQL query to create the database and table:

Post a Comment

Previous Post Next Post