OAuth2 Usage (Google)
Below you will find information on how to configure OAUTH2 when using the Google platform.
This applies to the following MFT Server features:
-
The email service configured in
Settings > MISCELLANEOUS >Email > Email -
Trading partners — POP3, IMAP, and SMTP
-
Trigger Actions — Check Email, Send Email and Send Group Email
Google Steps
-
Open API Library in the Google API Console.
-
From the projects list, select a project or create a new one. If the APIs & services page is not already open, open the console left side menu and select
APIs & services. -
On the left, click
Credentials. -
Click
New Credentials, then selectOAuth client ID. -
Select the application type:
Web applicationand enterRedirect URI(For ex: http://localhost). -
Click the
Createbutton. -
Save the
Client IDandSecret. -
Create the
Request URLusing the following format:https://accounts.google.com/o/oauth2/v2/auth?
scope= https%3A%2F%2Fmail.google.com%2F&
access_type=offline&
include_granted_scopes=true&
response_type=code&
state=state_parameter_passthrough_value&
redirect_uri=<redirect_uri>&
client_id=<ClientID>&prompt=consent
Implementation example (single continuous URL):
Copyhttps://accounts.google.com/o/oauth2/v2/auth?scope=https%3A%2F%2Fmail.google.com%2F&access_type=offline&include_granted_scopes=true&response_type=code&state=state_parameter_passthrough_value&redirect_uri=<redirect_uri>&client_id=<ClientID>&prompt=consent
Replace the redirect_uri placeholder (<redirect_uri>) and the client_id placeholder (<ClientID>) with the appropriate values, as described above. -
Hit the Request URL from a browser. Google's OAuth 2.0 server authenticates the user and obtains consent from the user for your application to access the requested scopes. The response is sent back to your application using the redirect URL you specified. If the user approves the access request, then the response contains an authorization code.
For example: http://localhost/?code=4/0AX4XfWj3c9KO2Si0iTcYnxXn7ojRJ52Kqcuo0eZeumtaO-Ur5uNbIxIP-60ZF7AEY1GwRA&scope=https://mail.google.com/
Obtain the code from the response, which in the above example is:
4/0AX4XfWj3c9KO2Si0iTcYnxXn7ojRJ52Kqcuo0eZeumtaO-Ur5uNbIxIP-60ZF7AEY1GwRA
MFT Server Steps
Below you will find the MFT Server fields related to OAuth2.
AuthenticationType — OAUTH2
Password/Token — Authorization code obtained in Step# 8
Token Endpoint URL — https://oauth2.googleapis.com/token
Client ID — ClientID from Step# 6
Client Secret — Client Secret from Step# 6
Redirect URL — Redirect URL from Step# 4