PlayTubeVideo

Gmail OAuth2 email delivery

Use Gmail OAuth2 when your installation needs authenticated Gmail delivery for notifications and transactional email.

Authenticated mail delivery

OAuth2 avoids storing a regular Gmail password in your application.

1. Create a Google project

Create or select a project in Google Cloud Console, configure the consent screen and add the Gmail API.

2. Create OAuth credentials

  1. Create a Web application OAuth client.
  2. Use the OAuth Playground redirect when following the token flow: https://developers.google.com/oauthplayground.
  3. Add a test user if the consent screen is still in testing mode.
  4. Record the client ID and client secret securely.

3. Generate a refresh token

  1. Open Google OAuth Playground.
  2. Enable Use your own OAuth credentials and enter the client ID/secret.
  3. Authorize the Gmail scope required by your mail workflow.
  4. Exchange the authorization code for tokens and copy the refresh token.

4. Configure the admin email settings

Open PUBLIC_URL/video-admin/settings/email. Select the Gmail/OAuth2 delivery option and enter the sender email, client ID, client secret and refresh token requested by the form.

Never publish tokens. Treat the refresh token like a password. Rotate it if it appears in logs, screenshots or a repository.

5. Send a test email

  • Save the email settings.
  • Send a password-reset or notification test to a controlled mailbox.
  • Check the server log for OAuth scope, sender or token errors.
  • Confirm your sender domain and Gmail account are permitted to send the expected volume.