\\
!1. Google Mail OAuth 2.0\\
\\
__Google Mail__ through __SMTP__/__IMAP__ requires __OAuth 2.0__ ([OAuth Wikipedia Link|https://en.wikipedia.org/wiki/OAuth]) for authentication. (More information : [Google IMAP-SMTP Link|https://developers.google.com/gmail/imap/imap-smtp]).\\
\\
__!!! Proxy Configuration:__ If your server accesses the internet through a proxy, make sure to whitelist the following domains for Google Mail Authentication:\\	
• oauth2.googleapis.com\\
\\
Start by navigating to Google APIs & Services: [Google APIs & Services Link|https://console.developers.google.com/projectselector/apis/credentials]\\
__!!!Note:__ Ensure sure the __GMAIL API__ is enabled at __Enabled APIs & services__. [Google API Library Link|https://console.cloud.google.com/apis/library]\\
\\
[SMTP Google Mail Integration/g_api_services.png]\\
\\
[SMTP Google Mail Integration/gmail_api_enabled.png]\\
\\
Setup Oauth Consent (if was not yet created), make an internal one: \\
\\
[attachments|create_consent.png]\\
\\
Set the support emails, the application domain and save it. 
\\
[SMTP Google Mail Integration/consent_settings_1.png]\\
[SMTP Google Mail Integration/consent_settings_2.png]\\		
\\
Go to the Credentials menu and create new credentials, choose OAuth client ID:
[SMTP Google Mail Integration/create_credentials.png]\\
\\
Choose Web application:
\\
[attachments|credential_config.png]\\
\\
It is required to set up the Authorized Redirect URIs. You can domain (where your CrushFTP is available), or localhost. The URI needs to end with:\\
{{{
?command=register_google_mail_api
}}}\\
\\
After Credentials are created copy the Client ID and Secret.\\ 
\\
Now if your credentials are setup, and your redirect domains are configured, you can use the credentials in CrushFTP to get your google auth token and get access.\\
__CrushFTP admin page url must match with the redirect url.__ In our example: http://XXXXcrushftp.com\\
In the Preferences -> General Settings -> SMTP Settings, at __username SMTP Server Username put your google email address. Then click "Get mail refresh token" to get the "SMTP Server Password"__. Put your client id and secret on the appeared form.\\
[attachments|oauth_form.png]\\
\\
If your domain is not verified you will get a warning message, click on Advanced and proceed further:\\ 
\\
[SMTP Google Mail Integration/not_verified_domain.png]\\
\\
Click on allow:\\
\\
[SMTP Google Mail Integration/allow_form.png]\\
\\
Once it is finished the "SMTP Server Password" input field will be filled with the refresh token.\\
\\
[SMTP Google Mail Integration/smtp_config.png]\\
\\