0
votes

I am trying to get outlook mails in my application using Outlook REST APIS

I have registered my application in AAD using my outlook account.

I have managed to get authorization code using:

https://login.microsoftonline.com/5d313248-7b5c-46a6-9d14-605dce8294c0/oauth2/authorize?response_type=code&client_id=aef57953-e481-44eb-8d97-60cf78658bdf&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=https%3A%2F%2Foutlook.office.com%2Fmail.read

However when i use code received from the redirect request I get:

{ "error":"invalid_client", "error_description":"AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided.\r\nTrace ID: 8305c47e-aabf-4837-bcbc-92169e8016a5\r\nCorrelation ID: 986e4afe-bd40-4717-b712-034227762f19\r\nTimestamp: 2016-04-05 21:34:37Z",

"error_codes":[70002,50012], "timestamp":"2016-04-05 21:34:37Z", "trace_id":"8305c47e-aabf-4837-bcbc-92169e8016a5", "correlation_id":"986e4afe-bd40-4717-b712-034227762f19" }

I have tried same from Java code and using REST client both.

Anyone else faced this issue?

1
Maybe your access token has expired. Please renew it before submitting the request.Lily_user4045

1 Answers

0
votes

Based on the Authorization Code Grant Flow here: https://msdn.microsoft.com/en-in/library/azure/dn645542.aspx, you're missing the step of acquiring access token (Step 4 in the picture below).

enter image description here

Using the code, you would need to get the access token and then use that access token you should be able to access Outlook REST API.