none
REST API Authentication In POSTMAN - SharePoint Online RRS feed

  • Question

  • I am trying to authenticate with the REST API for a list in SharePoint Online using POSTMAN.

    For example, the URL for my site looks something like this:

    https://mytenantname.sharepoint.com/sites/mysitecollection/_api/web/lists

    When I go to the URL for the REST API in browser I can access it fine using my SharePoint Online credentials. I log in and it returns the list of lists in JSON.

    When I try to use a GET in POSTMAN it fails with "Access Denied" or it shows the following error:

    {"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."}

    Which Authorization type should I be selecting in POSTMAN to authenticate correctly with SharePoint Online?

    Thanks in Advance

    Sunday, October 28, 2018 10:26 PM

All replies

  • Hi Patrick,

    You can check it with NTLM/Basic authentication modes.


    Cheers,

    Monday, October 29, 2018 1:37 AM
  • Hi Patrick,

    The following steps for your reference.

    Step 1: Know your Tenant ID and Resource ID

    Step 2: Register a new app

    Step 3: Grant permissions

    Step 4: Get Access Token for the Office365 Tenant.

    Step 5: Make a call to Sharepoint REST API

    The Header like this.
             Accept : application/json;odata=verbose
             Authorization : Bearer <Access Token>

    More information:

    SharePoint Online Authentication for API Access using POSTMAN

    http://pratapreddypilaka.blogspot.com/2018/05/sharepoint-online-authentication-for.html

    Access SharePoint Online using Postman

    http://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, October 30, 2018 3:07 AM
    Moderator
  • THanks Amit but how?
    Monday, November 5, 2018 6:42 AM
  • Thanks Dennis.

    Will give it a shot

    Monday, November 5, 2018 6:42 AM
  • Hi Dennis,

    Do you have an official document to get an access token as blog below?

    http://pratapreddypilaka.blogspot.com/2018/05/sharepoint-online-authentication-for.html.

    I am trying to find it from the MS website but cannot

    Thanks,

    Thong

    Tuesday, April 21, 2020 11:35 AM
  • The official doc for the auth flow is at https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow if you are using client credentials or https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow if you are logging in as a user.
    Tuesday, May 12, 2020 8:43 PM
  • The most official doc about SharePoint App-only auth I have seen is at https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs
    Tuesday, May 12, 2020 8:48 PM