"ErrorAccesDenied" when using REST APIs to access Contacts, Calendar and Mails in Office365 RRS feed

  • Question

  • Hi,

    I am developing a web application to integration with Office365 using Azure AD method. I have created a Multi-Tenant application in Azure AD and using the client-id , client secret I have successfully generated access token and refresh token.

    Based on the rest API documentation I am setting the header with Authorization, User-Agent, Client-request-id as the parameters. But when I make a request to fetch all the contacts getting the following response.

    {"error":{"code":"ErrorAccessDenied","message":"Access is denied. Check credentials and try again."}}

    I have followed all the steps that were listed in this blog http://blogs.msdn.com/b/exchangedev/archive/2014/03/25/using-oauth2-to-access-calendar-contact-and-mail-api-in-exchange-online-in-office-365.aspx

    Any help is appreciated.Thank you in advance.

    Monday, December 22, 2014 3:37 PM

All replies

  • 1. What URL are you trying to access, and with what method (GET, POST, etc)?

    2. If you copy the value that you are sending in the Authorization header (everything after the Bearer tag), and paste it into http://jwt.calebb.net/, what do you see in the scp and aud claims?

    Monday, December 22, 2014 5:39 PM
  • Jason,

    Thank you for the response.

    I am making GET request to get the contacts using this URL - https://outlook.office365.com/api/v1.0/me/contacts

    When I copy and paste in JWT this what I am seeing,

    scp - Calendars.Read Calendars.Write Contacts.Read Contacts.Write full_access_as_user Mail.Read Mail.Send Mail.Write

    aud - https://outlook.office365.com/

    Tuesday, December 23, 2014 8:20 AM