Skip to content

BlacksilverConsulting/O365-Outlook-OAuth2-Tools

Repository files navigation

O365-Outlook-OAuth2-Tools

Utilities for working with O365 Outlook and OAuth2

Many thanks to Chilkat Software, their Perl library and examples saved me uncountable hours on this project.

To use o365-token-saver.pl:

  1. Create an application in your AAD environment, and note the client ID and Client secret. (If you're not sure what this is, there is a walkthrough)
  2. TODO: There are some extra AAD steps here, like setting the callback URL and API permissions, that need to be added here
  3. Install Perl (On Windows, use Strawberry Perl)
  4. Install the Chilkat library
  5. Create a directory to work in, and download o365-token-saver.pl to it
  6. Alter the code to include your Chilkat license key
  7. Create a .o365 directory under the work directory
  8. Create the file _nn_-config.json in the .o365 directory based on the 00-config.json file in this repo
  9. Replace all of the placeholders in that file with the appropirate values from your environment
  10. IMPORTANT: If there is a firewall on the system where you are running this script, configure it to allow requests to TCP/3017 to reach o365-token-saver.pl or it won't work
  11. Run o365-token-saver.pl with the _nn_ from step 7 as the only command-line parameter
  12. When the browser opens, enter the email address and password
  13. If this is the first time using this account with this application, you will also need to grant the application the requested permissions
  14. If you complete the sign-on within 30 seconds, the browser will display a success message
  15. The access token has been saved as _nn_-token.json in the .o365 directory

The remaining instructions are application specific and won't make much sense without that application.

To use img-eng-email.pl.patch.o365:

On a system with a recent version of /usr/bin/img-eng-email.pl, use the command patch -p0 < img-eng-email.pl.patch.o365 to alter it to invoke img-eng-email-o365.pl for message download when cnf_Email_Import.cei_Options contains the 365 flag.

To use img-eng-email-o365.pl:

  1. Place it in the /var/imaging/bin/ directory with appropriate ownereship and permission
  2. Don't forget to update it to include your license key
  3. Install the Chilkat Perl library that matches this version of Perl
  4. Create the /home/mailer/.o365 directory, with RWX permissions for the imaging group
  5. Place the _nn_-config.json file used with o365-token-saver.pl in the directory created in step 2
  6. Place the _nn_-token.json file generated by o365-token-saver.pl in the directory created in step 2
  7. psql images -c "UPDATE cnf_Email_Import SET cei_Options = cei_Options || ' 365' WHERE cei_Sequence = _nn_;"
  8. Optional: su mailer and run it manually with /var/imaging/bin/img-eng-email-o365.pl _nn_
  9. Check /var/log/imaging/mailer to see if it is working

About

Utilities for working with O365 Outlook and OAuth2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages