Configure Google OAuth2 Client ID and Client Secret

Configure Google OAuth2 Client ID and Client Secret

After creating the Google OAuth2 Project and enabling the required APIs during the environment preparation step, you need to create an OAuth2 Client ID and Client Secret to integrate Google Sign-In into your e-commerce system.

Steps to follow:

  1. Access Google Cloud Console

  2. Create OAuth2 Client ID

    • Navigate to APIs & ServicesCredentials. credentials

    • Click + Create CredentialsOAuth client ID. create_oAuth_client_id

    • Click Configure consent screen. configure_consent_screen

    • Click Get Started. get_started

    • Fill in the following information:

      • App name: FcjFashionShop

      • User support email: Enter your email

      • Click Next information_google_oauth

      • Email addresses: Enter your email

      • Click Next contact_information

      • Check I agree to the Google API Services: User Data Policy.

      • Click Continue and then Create finish_create_oauth

    • In Metrics, click Create OAuth client select_create_oauth_client

    • For Application type, select Web application

    • Name: FcjFashionShop info_oauth_client_id

    • In Authorized JavaScript origins

      • Click Add URI to add a new URL
      • Paste your S3 Bucket website endpoint (the static website URL you copied earlier)
    • In Authorized redirect URIs

      • Click Add URI to add a new URL
      • Paste the Invoke URL of your API Gateway that you copied earlier, replacing your-API-Gateway-domain in the example below
      • Click Create
      your-API-Gateway-domain/api/users/auth/google/callback
      

    create_oauth_client_id

    • ClientID and ClientSecret have been created successfully. Copy and save them for later use. success_clientid_client_secret

Authorized JavaScript origins: this is your frontend domain (the S3 Static Website endpoint).
Authorized redirect URIs: this is the backend endpoint (API Gateway) that handles the Google callback.

Security note:
Never publish your Client Secret on Github or anywhere public!

Conclusion:
After completing these steps, you have all the necessary information to configure Google OAuth2 for both backend and frontend, and are ready to implement Google Sign-In for your e-commerce website project on AWS.