Enabling Authentication
To enable authentication with GitHub and Google in your project, follow these steps to set up the necessary environment variables.
Enable Google Login
Create Credentials on Google Cloud Console:
Go to Google Cloud Console.
Create a new project or select an existing one.
Navigate to "APIs & Services" > "OAuth consent screen".
Configure the consent screen for your project.
Go to "Credentials" > "Create Credentials" > "OAuth 2.0 Client IDs".
Fill in the required details and create the credentials.
Obtain your
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET.

GCP screenshot Add to .env File:
Open your
.envfile and add the following:
GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret
Enable GitHub Login
Create a GitHub Application:
Go to GitHub Developer Settings.
Click on "New OAuth App".
Fill in the required details and register your application.

Github custom oauth app creation screen Obtain your
GITHUB_IDandGITHUB_SECRET.

Github custom oauth oauth app token generation Add to .env File:
Open your
.envfile and add the following:
Example .env File
Here is an example of what your .env file should look like after adding both Google and GitHub credentials:
Test Authentication: Open http://localhost:3000 in your browser and test the Google and GitHub login functionalities.
Additional Resources
Need Help?
If you have any feedback or run into any issues, don't hesitate to reach out at [email protected].
Happy coding!
Last updated
Was this helpful?