Google OAuth 2.0 Setup
11 min
overview google oauth 2 0 for smtp is a secure authentication mechanism that allows applications like onprintshop to send emails through gmail without using traditional username and password based authentication instead of relying on basic authentication, oauth 2 0 uses token based authorization, where access is granted through secure tokens generated after user consent this approach enhances security, reduces the risk of credential exposure, and aligns with google’s modern authentication standards in the context of onprintshop, integrating google oauth 2 0 with smtp ensures seamless and secure email communication for system notifications, order updates, and other transactional emails the configuration involves setting up a google cloud project, enabling the required apis, generating oauth credentials, and linking them within the onprintshop admin panel to establish a trusted connection purpose the purpose of this setup is to enable secure email sending through gmail by establishing a trusted connection between your google account and onprintshop this configuration helps protect sensitive credentials, aligns with modern security standards, and ensures uninterrupted email delivery without manual authentication handling configuration google configuration step 1 create a google cloud project go to the google cloud console https //console cloud google com and sign in with your google account if you already have an existing project, you may use it and skip this step otherwise, click on “ select a project ” and choose “ new project ” enter a suitable project name, such as “ onprintshop project ,” select the appropriate organization if applicable, and click “ create ” to proceed step 2 enable gmail api once the project is ready, navigate to the api library on the api library page, search and enable the gmail api to allow email related operations within your project step 3 configure oauth consent screen navigate to apis & services > oauth consent screen in the google cloud console click “get started” to begin configuring the oauth consent screen for your application enter the required application details app name ops email system user support email enter your preferred support email address once completed, click “next ” under the audience section, select “external” to allow users outside your organization to access the application, and then click “next ” enter the contact email address where google can send notifications or updates related to the project click “next ” review the entered details and click “create” to complete the oauth consent screen setup step 4 create oauth 2 0 credentials after this, create oauth 2 0 credentials by selecting the web application type navigate to apis & services > credentials in the google cloud console click “create credentials” and select “oauth client id ” on the create oauth client id page, configure the following details application type web application name ops oauth client authorized redirect uri https //your ops domain com/admin/get oauth token php after entering the required details, click “create ” once the oauth client is created, click “download json” to download the credentials file for future configuration configuration in onprintshop admin panel after completing the google configuration, log in to the onprintshop admin panel and navigate to the email/sms configuration section to create a new email setup in the configuration form, enter the required details enter the email connection title (e g , “google oauth email”), select smtp as the connection type enter the smtp host as smtp gmail com , select tls encryption, and set the port to 587 choose smtp authentication as yes , then oauth 2 0 as the authentication method with google as the provider provide the google email address as the smtp username, along with the client id and client secret generated from the google cloud console configuration generate the refresh token using the provided authorization link and grant the required permissions to establish a secure connection between onprintshop and your google account once the refresh token is generated successfully, send a test email to verify that the configuration is working correctly after confirming successful email delivery, save the email configuration finally, navigate to content management → email/sms → set notification tab and assign the configured google email address as the “from email” to complete the setup