# Setting up OAuth emailing

## Overview

Outlook OAuth is a secure authentication standard used by Microsoft that allows you to connect your email to third-party apps, such as Accentis Enterprise, without sharing your actual password.

Instead of typing your password into an app, OAuth grants the app a digital token that proves your identity. This keeps your account secure and allows you to revoke the app's access at any time without changing your main email password.

This guide details the process for the initial setup for your database, and the process each user needs to follow to authorise themselves.

### Who is this document for?

This document is for IT staff and administrators who need to:

- Configure Accentis Enterprise to send emails through OAuth for the first time.
- Refer back to this document to renew the expiry for Accentis Enterprise's authorisation.

## Basic steps to setup OAuth

1. Register Accentis Enterprise in the Microsoft Azure Portal

2. Create a secret value for Accentis Enterprise

3. Add permissions for Accentis Enterprise

4. Enter authorisation details into your database

5. Authorise users Accentis Enterprise

## 1. Register Accentis Enterprise in the Microsoft Azure Portal

1. Navigate to Microsoft Azure - Registered Apps and login as an admin user.
2. Click New registration.

1. On the Register an application page, enter the details as below:
   1. Name - This can be anything. Set it to something that easily identifies that this is for Accentis so that you can refer back to it later. We recommend "Accentis SMTP".
   2. Supported account types - Leave this set as it is.
   3. Redirect URI (optional) - Select "Web" from the dropdown list and enter "http://localhost:3017"

1. Select Register.
2. Make note of the Application (client) ID and Directory (tenant) ID as you will need to enter these into Accentis Enterprise later.

## 2. Create a secret value for Accentis Enterprise

1. From the navigation menu on the left, select Certificates & secrets and navigate to the Client secrets tab.

1. Select New client secret, and enter the details as below:
   1. Description - This can be anything. Set it to something that easily identifies that this is for Accentis.
   2. Expires - Set this based on your organisation's security preferences. You will need to generate a new client secret every time your current one is about to expire to maintain authorisation.

1. Select Add.
2. Copy the secret Value and make note of it as you will need to enter it into Accentis Enterprise later.
   1. The client secret cannot be accessed again once it is closed. If you forget to copy your secret value, you will need to create a new client secret.

## 3. Add permissions for Accentis Enterprise

1. From the navigation menu on the left, select API permissions.

1. Select Add a permission.

1. From the Microsoft APIs tab, select Microsoft Graph.

1. Select Delegated permissions.

1. In the search box, type "smtp.send"
2. In the Permissions list, expand the SMTP section and tick the box for SMTP.Send.

1. Select Add permissions.

## 4. Enter authorisation details into your database

1. Log into your Accentis Enterprise database.
2. Navigate to the System preferences form (System > Preferences…) and select System > Emailing / Faxing tab.
3. Select Edit and enter the below details:
   1. Enable direct emails from Accentis Enterprise - ensure this checkbox is ticked.
   2. SMTP oauth tenantID - Enter the Directory (tenant) ID you noted from 1. Registering Accentis Enterprise.
   3. SMTP oath ClientID - Enter the Application (client) ID you noted from 1. Registering Accentis Enterprise.
   4. SMTP oauth client secret - Enter the secret value you noted from 2. Creating a secret value for Accentis Enterprise.
   5. SMTP server - Enter smtp.office365.com:587.
   6. Use .NET Emailer - ensure this checkbox is ticked.
   7. Leave the other fields as they are.

## 5. Authorise users Accentis Enterprise

Each user that needs OAuth will need to authorise their account. This will only be required once as the tokens refresh themselves automatically.

This process needs to be performed by the user themselves.

1. On the main Accentis toolbar, press CTRL+SHIFT+R and run SA4948.
2. Check Authenticate EMAIL sending FROM Accentis.

1. Select Run to open a Microsoft login screen in your web browser.
2. Login with your Microsoft 365 credentials.
   1. Once logged in, you may be required to accept additional permissions.
   2. If you're login is successful, you will be redirected to the below page and will receive a Successfully generated token message in Accentis Enterprise.

1. Your account is now authorised to send emails via OAuth.