Use OAuth2 with Omnis 10.1

Josh Luchies josh.luchies at royalhomes.com
Fri Dec 18 18:09:45 EST 2020


I actually use oAuth outside of Omnis as we have some scanners and a 
phone system that need to connect to google for sending email as well.

The way I did it, and much of this is applicable to Omnis as well (Steps 
1-4) is:

1. I setup a project in the developers console with the gmail api 
accessible.

2. I setup a service account (for the project in the step above) and 
downloaded the key file. It's an option when you create credentials.  
The key file contains the information required to send to get an 
authorization key which is then used when you need to send an email.

3. I gave the service account access to my organization's gmail domain.  
In your gmail domain admin section, go to Security, then API controls 
and finally Domain Wide Delegation.

4. You do have to specify the scope and that varies depending on how the 
program you are using is setup. You may have to look in the errors 
reported by Omnis or in the Console to find the scope being used.

5. I created an Email relay server in Python to relay email coming in to 
a port on a server, sending it using the credentials from the service 
account to the specified email address and from the specified email 
address.  This is local only, I do not endorse creating public relay 
servers using your own gmail domain...

6. I started testing it a while ago and it works as long as gmail is up 
and accessible from the server.  I do get email notification when it 
goes down from the python script saying it can't access.

NOTE: The Service Account security is managed in your gmail accounts 
domain admin, so you can disable it if someone bad gets your file.

I did not get oauth authentication working properly in 8.1.7 and haven't 
tried in 10.1 yet because I need the relay regardless of whether I can 
send directly from Omnis or not.

-- 
Josh Luchies
IT Administrator
Royal Homes Limited
Phone: 519 357 2606 ext 245



More information about the omnisdev-en mailing list