This repository contains the implementation of OAuth for Google Sign-In in PHP. Users can log in with their Google accounts and access the dashboard of Pandora Company Limited.
-
login.php: This file represents the login page. It contains the HTML markup and PHP script necessary to initiate the Google Sign-In process.
-
redirect.php: This file is responsible for handling the OAuth flow. It initiates the Google login process, exchanges the authorization code for an access token, and retrieves the user's information.
-
dashboard.php: This file displays the user's dashboard after successful authentication. It shows a welcome message and allows users to log out.
To set up the project, follow these steps:
- Clone the repository.
- Run
composer install
to install the necessary dependencies. - Configure the
client_secret.json
file with the appropriate credentials for your Google application. - Ensure that the appropriate PHP environment is set up for the project to run successfully.
- Access the
login.php
page. - Click on the "Sign in with Google" button to initiate the authentication process.
- Upon successful authentication, the user is redirected to the dashboard.
- On the dashboard, the user can view a personalized welcome message.
- Click the "Logout" button to end the session and return to the login page.
This implementation is a basic demonstration of OAuth integration for Google Sign-In. For a production environment, it is recommended to follow best practices for security and error handling.
- [Charindu Thisara]
We would like to acknowledge the following resources that helped in the development of this project:
Last Updated: [21/10/2023]