none
Project Online OData using Access Tokens RRS feed

  • Question

  • I have built a SharePoint provider-hosted app that retrieves data from Project Online.

    I'm struggling with accessing the Project Online OData feed at /_api/ProjectData without having to specify a user's credentials like all the samples (since I want this published to the Store).

    As I understand it OData doesn't support app-only access tokens, so I get a user+add-in access token using this method.

    //Get user+add-in access token. string accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;

    I can use that token to make CSOM calls successfully so I know the token is valid, the user that installed my provider-hosted app has the necessary Project permissions, and the app manifest is setup correctly.

     

    However, when I try to use that same token in a simple WebClient to make OData REST calls by adding the token to my header:

    client.Headers[HttpRequestHeader.Authorization] = $"Bearer {accessToken}";

    I always get: (403) Forbidden

    Can anyone shed some light on this?  Or point me to an example that uses access tokens to access OData instead of user credentials?

    Thanks,

    Mike

    Tuesday, May 22, 2018 4:33 PM

Answers

All replies