Trouble with Microsoft Email functionality using Graph API

Until last year, I implemented office 365's email into our web-app using the MicrosoftLoginConnector for auth and office365 to get the emails and display it within out application.

However, recently Microsoft had stopped supporting the existing api to get emails and is now relying on Microsoft Graph API. 

Fortunately, last month the MicrosoftLoginConnector had been updated and I was able to login to officemail (after setting up Azure portal config) and successfully received the Access Token in response (after logging in).

This Access Token is used as an input parameter to get emails (using Graph API), but this is where I am encountering an error.


The following is the error i am getting in response when trying to get email:


{
  "error": {
    "code": "InvalidAuthenticationToken",
    "message": "Access token validation failure. Invalid audience.",
    "innerError": {
      "request-id": "72d68995-6ed0-4641-a70c-1e414d256ddc",
      "date": "2019-05-21T19:23:45"
    }
  }
}

Any help will be appreciated.


Thanks

Hi Anurag,

This is a Microsoft Graph API error, maybe you should look for answers somewhere more Microsoft Graph specific than the generic OutSystems forums?

You may want to search for that exact same error message on Google, for instance? I'm sure several of the entries you find will be useful. If you are doing something like what's describe here, you may be requesting a token for the wrong resource.