I am configuring an Email Account with Microsoft Office 365 as the email provider.
Using Microsoft Graph as the Receiver, but currently getting the following issue and the connectivity fails.
Failed while retrying to fetch accesstoken for clientID = [ClientID]: Access token endpoint invocation failed : {ErrorMessage=Response status : 400 Bad Request, statuscode=400}
Based on the error description, It looks like we are unable to fetch the token as Microsoft Graph complains that the token request is not valid. This could be possible if OAuth2.0 configuration is not correct or not inline with what Microsoft Graph expects. Please refer to this Pega article for detailed explanation on how to configure OAuth2.0 authentication for sending and receiving emails using Microsoft Graph. Please let me know if the problem still persists.
Hi all,
For anyone arriving on this thread from intense googling of 400 error on Pega / Azure, the Doc does forgot a very important point : the scope.
In your Auth Profile you must set the scope to “.default” otherwise Microsoft Graph will keep returning 400 and the debugging tool from Pega is not helpful since it does not display the body of the error sent by Microsoft and if you switch to Microsoft API v1.0 the error becomes a 401 which is even more confusing.
Another weird behavior was that switching to SMTP for outbound email account while having the Oauth Auth profile set up with v1.0 and empty scope was working while the Microsoft Graph kept send the 401.
Would be nice to add the scope details into the doc and integrate the body of the HTTP error into the testing tool, I had to curl my way out of there. On the other hand the debugging logs for SMTP rock !