I'm having a problem using the script to test delegated access (it works fine for app level permissions).
I found it needs a redirect URL on the command line to get me to the login page but when I copy the redirect URL from the browser I get the error "Failed to obtain OAuth token":
PS C:\Users .\Test-EWSAppAccess.ps1 -tenantid "70....75" -appid "226...9d" -RedirectUri http://localhost
Please complete log-in via the web browser, and then copy the redirect URL (including auth code) to the clipboard to continue
Auth code acquired, attempting to obtain access token
Failed to obtain OAuth token
At C:\Users\Test-EWSAppAccess.ps1:197 char:5
+ throw "Failed to obtain OAuth token"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Failed to obtain OAuth token:String) [], RuntimeException
+ FullyQualifiedErrorId : Failed to obtain OAuth token