This project demonstrates how to set up Google OAuth 2.0 authentication using PHP and style your project with Tailwind CSS and Flowbite components.
Start by cloning the repository to your local environment:
git clone https://github.com/Dawn-o/Oauth-PHP.git
cd Oauth-PHP
To install Tailwind CSS and Flowbite as dependencies in your project, run the following command:
npm install -D tailwindcss flowbite
This will add both Tailwind CSS and Flowbite as development dependencies in your project.
To configure your .env
file for OAuth 2.0, follow these steps:
Create OAuth 2.0 Credentials:
Go to the Google Cloud Console.
Create a new project or select an existing one.
Navigate to "Credentials" and click on "Create Credentials" > "OAuth Client ID."
Set the Authorized redirect URI to:
http://localhost/Oauth/function/google_auth.php
Adjust this URI if necessary to match your local or production setup.
Update .env
File:
After creating the credentials, you will receive a Client ID and Client Secret. Add these to your .env
file along with the redirect URI:
CLIENT_ID='<YOUR_CLIENT_ID>'
CLIENT_SECRET='<YOUR_CLIENT_SECRET>'
Replace
To run the project, you can using XAMPP
Install and Configure XAMPP:
Move Project to XAMPP Directory:
oauth-php
) to the htdocs
directory inside your XAMPP installation (usually located at C:\xampp\htdocs
).Access the Project:
http://localhost/oauth-php
(or whatever the path is relative to htdocs
).Verify OAuth Configuration:
Check for Errors:
Monitor your browser console and XAMPP's Apache error logs for any issues during the authentication process and resolve them as needed.
Watch for any errors or issues in the browser console and terminal, and resolve them as needed.