Google OAuth in cypht

Welcome to the documentation allowing you to enable google authentication in cypht.

google-oauth-screen

1. Go to the Google Cloud Console

2. Create or select a project

  • If you don't have a project yet, click on "Create Project" and give it a name
  • If you already have a project, select it from the list.
google-oauth-screen

3. Set up the OAuth consent screen

  • Go to "APIs and Services" > "OAuth Consent Screen".
  • Fill in the required information :
    • Select the type of application (External or Internal depending on your case).
    • Application Name(visible to users).
    • Support email and administrative contact email.
    • Allowed domains (add your domain, e.g. votresite.com or localhost for development).
    • Privacy policy URL (if available).
    • Save and proceed to the next step.

4. Since we are in Test mode, still in "API and Services" > "OAuth consent screen"

  • Go to Audiance(1)
  • Add users(2)
  • Enter the addresses that will have access to the app(3)
  • Then the list(4) will be displayed

NB : if you don't add the address, when you try to connect in cypht, you won't have access, google will return an error.

google-oauth-screen

5. Create OAuth credentials

  • Go to "APIs and Services" > "Credentials"
  • Click on "Create credentials" > "OAuth client ID".
  • Choose the type of application: Web application.
  • Fill in the fields :
    • Name (e.g. "My App - Gmail Authentication").
    • Allowed redirect URI :
      • For development: http://localhost:3000/auth/google/callback (adjust the port according to your app).
      • For production: https://yourdomaine.com/auth/google/callback.
  • Click "Create".

6. Get your GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET

After creation, Google will display

  • ID client(1) (GMAIL_CLIENT_ID).
  • Client secret (2)(GMAIL_CLIENT_SECRET).

Once you already have your credentials, go to the ".env" file at the root of the cypht project, then look for "GMAIL_CLIENT_ID" where you will put the number 1 and "GMAIL_CLIENT_SECRET" where you will put the number 2.

Now your configuration is done.

google-oauth-screen