In this tutorial, we’ll show you every step needed to set up the Office365 Oauth2 authentication for Email To SMS Poller.
1. Open the Azure Cloud Portal: https://portal.azure.com
2.Login with the administrator account. If you don't have administrator rights for Office365, ask your admin to complete steps 3-6.
3. Go to Manage Azure Active Directory (you may have use the searchbox if the button is not on the landing page).
4. In the menu on the left, select App Registrations
5. In the toolbar, click on New registration
- Enter a Name like "SMSEagle EMail2SMS Poller" (this is only for your personal organization, you can choose any name you like)
- Under Supported account types select "Accounts in this organizational directory only (Single tenant)"
- Under Redirect URI select Type: Web. Enter https://URL.OF.YOUR.SMSEAGLE/plugin/email2sms_poller/o365_oauth - replace URL.OF.YOUR.SMSEAGLE with actual URL (for example: https://10.10.0.101/plugin/email2sms_poller/o365_oauth or https://mydevice.mydomain.com/plugin/email2sms_poller/o365_oauth )
- Click on Register
6. You are now taken to the details page for the new App.
- The Client id and Tenant id can be found under the heading "Essentials", copy them somewhere safe
- In the menu on the left, select Certificates & secrets
- Click on New client secret
- Description: Any description text (can be "Password")
- Expires: however long you want (suggested value: 24 months)
- Click Add button
- The Client secret can be found under the header: Value, copy it somewhere safe
- In the menu on the left, select API permissions
- In the toolbar, click on Add a permission
- Click on Microsoft Graph
- Click on Delegated Permissions
- Search for "IMAP.AccessAsUser.All" and select it
- Search for "POP.AccessAsUser.All" and select it
- Search for "SMTP.Send" and select it
- Click on Add permissions
Comment: Although only IMAP method will be used within the app, Microsoft requires all three permissions for the Oauth2 authentication to work correctly - click on Grant admin consent for [your company]
- confirm with Yes button
- green ticks should appear in the Status column
7. If you are signed in to your Office 365 account in your browser, please sign out before continuing.
8. Go back to SMSEagle webGUI > menu Email To SMS Poller > Settings tab
- choose Protocol: IMAP + Oauth2 (Office365)
- enter Host for IMAP: outlook.office365.com
- Username: enter email address for the account which will be used for Poller
- OAuth Client ID: value saved in steps above
- OAuth Client Secret: value saved in steps above
- OAuth Tenant ID: value saved in steps above
- click Save button
- click Authenticate via Oauth button
- once you’ve clicked the Authenticate via Oauth button, you should be redirected to a login page. Sign in with the email account that you want to use for Email To SMS Poller to accept Microsoft permission query for access to the Inbox
- after the process is completed you will be redirected back to SMSEagle webGUI. You should see "Oauth authentication success" message if the process is completed successfully
Final Notes: It can take up to several hours for Azure permissions changes to propagate throughout Azure servers. If you encounter unexpected Microsoft permission alerts (for example "Need admin approval") in point 7. please wait until your app permissions propagate.