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

  1. Create Credentials on 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_ID and GOOGLE_CLIENT_SECRET.

    GCP screenshot
  2. Add to .env File:

    • Open your .env file and add the following:

    GOOGLE_CLIENT_ID=your_google_client_id
    GOOGLE_CLIENT_SECRET=your_google_client_secret

Enable GitHub Login

  1. Create a GitHub Application:

    Github custom oauth app creation screen
    • Obtain your GITHUB_ID and GITHUB_SECRET.

    Github custom oauth oauth app token generation
  2. Add to .env File:

    • Open your .env file 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?