# Connecting to EXO using an existing OAuth 2.0 token

**URL:** <https://forums.powershell.org/t/connecting-to-exo-using-an-existing-oauth-2-0-token/18017>\
**Category:** PowerShell Help\
**Created:** [November 22, 2021, 6:08pm UTC](https://forums.powershell.org/t/connecting-to-exo-using-an-existing-oauth-2-0-token/18017 "2021-11-22T18:08:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dembryrfx](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@dembryrfx](https://forums.powershell.org/u/dembryrfx)\
**Post date:** [November 22, 2021, 6:08pm UTC](https://forums.powershell.org/t/connecting-to-exo-using-an-existing-oauth-2-0-token/18017/1 "2021-11-22T18:08:14Z")

</div>

Hi folks, we are developing an application to assist our IT helpdesk technicians with spam-blocking tasks they presently do manually.

Our app is hosted in Amazon S3 and uses the Microsoft Graph API on the client side to acquire OAuth access and refresh tokens. We are currently using [the authorization code flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow).

We want to use Security & Compliance Center to perform content searches as part of our spam-blocking tool. Security & Compliance Center is **mostly** a hard requirement. (To my knowledge there’s no way to do this using the Graph API.)

To my knowledge, in order to connect to Security & Compliance in PowerShell, we have to connect to `ExchangeOnlineManagement` first. I’ve tried many different things to pass the **existing** OAuth access token but no dice.

PowerShell code would be running in an AWS Lambda function.

Any solution would be appreciated. I’m open to using a **second** authentication solution if we need to use it for Security & Compliance. (There’s no guarantee we’ll be open to any other particular platform change.)

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:20pm UTC](https://forums.powershell.org/t/connecting-to-exo-using-an-existing-oauth-2-0-token/18017/2 "2024-05-16T20:20:12Z")

</div>


