Invalid client secret is provided. while works with outlookmail API in WSO2

Justin Raj 1 Reputation point
2021-07-08T07:20:22.497+00:00

Hi Team,

I have successfully generated Accesstoken, refresh Token by following steps below.

Steps:

  • App Registration is done in Azure Active Directory.

App Registration

  • Client Secret also got

ClientSecret

  • List of API Permission Given

Permission

  • As per auth-v2-user docs, I followed the remaining steps to generate credentials, code value got.

Below mentioned Authorization Request pasted in google URL and got code value as well.

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?  
client_id=12ec4343-xxxx-xxxx-xxxxx-xxxxxxx  
&response_type=code  
&redirect_uri=https://oauth.pstmn.io/v1/browser-callback  
&response_mode=query  
&scope=offline_access%20Mail.Read%20Mail.ReadBasic%20Mail.ReadWrite%20Mail.Read.Shared%20Mail.ReadWrite.Shared%20Mail.Send%20Mail.Send.Shared%20MailboxSettings.Read%20MailboxSettings.ReadWrite%20IMAP.AccessAsUser.All%20POP.AccessAsUser.All%20SMTP.Send%20Files.Read%20Files.Read.All%20Files.ReadWrite%20Files.ReadWrite.All%20Files.ReadWrite.AppFolder%20Files.Read.Selected%20Files.ReadWrite.Selected%20User.Read%20User.ReadWrite%20User.ReadBasic.All%20User.Read.All%20User.ReadWrite.All%20User.Invite.All%20User.Export.All%20User.ManageIdentities.All  
&state=12345  
  • Next step is to get AccessToken, for this POST request made in Postman which gives AccessToken in Response

AccessToken,RefreshToken generation

{  
    "token_type": "Bearer",  
    "scope": "email Files.Read Files.Read.All Files.Read.Selected Files.ReadWrite Files.ReadWrite.All Files.ReadWrite.AppFolder Files.ReadWrite.Selected IMAP.AccessAsUser.All Mail.Read Mail.Read.Shared Mail.ReadBasic Mail.ReadWrite Mail.ReadWrite.Shared Mail.Send Mail.Send.Shared MailboxSettings.Read MailboxSettings.ReadWrite openid POP.AccessAsUser.All profile SMTP.Send User.Export.All User.Invite.All User.ManageIdentities.All User.Read User.Read.All User.ReadBasic.All User.ReadWrite User.ReadWrite.All",  
    "expires_in": 3599,  
    "ext_expires_in": 3599,  
    "access_token": "eyJ0eXAiOiJKV1QiLCJub25jZSI6InZSWGgtd29fZnBpTzdLVXg1MW....",  
    "refresh_token": "0.AXEAYH3m5fSttECIPDUdwv7vTkND7BJopVFGrZIDh...."  
}  

When i am using above fgenerated credentails in WSO2 Outlook init operation i am getting below error.

{"error":"invalid_client","error_description":"AADSTS7000215: Invalid client secret is provided.\r\nTrace ID: 6f72ab23-7ee4-4b74-980c-f173e1e70602\r\nCorrelation ID: 620f9b6d-ab78-4a88-92b9-3cce0c63feca\r\nTimestamp: 2021-07-08 06:52:44Z","error_codes":[7000215],"timestamp":"2021-07-08 06:52:44Z","trace_id":"6f72ab23-7ee4-4b74-980c-f173e1e70602","correlation_id":"620f9b6d-ab78-4a88-92b9-3cce0c63feca","error_uri":"https://login.microsoftonline.com/error?code=7000215"}  
  
Microsoft Graph Mail API
Microsoft Graph Mail API
A Microsoft API that supports accessing data in users' primary mailboxes and in shared mailboxes.
908 questions
0 comments No comments
{count} votes