Files GraphAPI do return 403 until the file is loaded by the user











up vote
0
down vote

favorite












As User#1, we're using this API to create a shared link:
https://graph.microsoft.com/v1.0/drives/{{driveId}}/items/{{itemId}}/createLink
This is successful and returns a ShareURI.



As User#2, we're using this API to get information about the item shared by User#1.
https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem



However, /driveItem returns a status code of 403 with the following body:



HTTP 403
{
"error": {
"code": "accessDenied",
"message": "The sharing link no longer exists, or you do not have
permission to access it.",
"innerError": {
"request-id": "73e65e0a-54b8-4722-9726-82297076276e",
"date": "2018-11-07T16:20:03"
}
}
}


To prevent this 403 from happening, User#2 needs to load the ShareURI in a web browser. Once User#2 does this, then the request to the exact same URI
https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem
return 200OK and the expected json body.



Why does User#2 have to load the ShareURI in a browser before being able to use Graph APIs on that ShareURI? Is there a workaround?










share|improve this question


























    up vote
    0
    down vote

    favorite












    As User#1, we're using this API to create a shared link:
    https://graph.microsoft.com/v1.0/drives/{{driveId}}/items/{{itemId}}/createLink
    This is successful and returns a ShareURI.



    As User#2, we're using this API to get information about the item shared by User#1.
    https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem



    However, /driveItem returns a status code of 403 with the following body:



    HTTP 403
    {
    "error": {
    "code": "accessDenied",
    "message": "The sharing link no longer exists, or you do not have
    permission to access it.",
    "innerError": {
    "request-id": "73e65e0a-54b8-4722-9726-82297076276e",
    "date": "2018-11-07T16:20:03"
    }
    }
    }


    To prevent this 403 from happening, User#2 needs to load the ShareURI in a web browser. Once User#2 does this, then the request to the exact same URI
    https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem
    return 200OK and the expected json body.



    Why does User#2 have to load the ShareURI in a browser before being able to use Graph APIs on that ShareURI? Is there a workaround?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      As User#1, we're using this API to create a shared link:
      https://graph.microsoft.com/v1.0/drives/{{driveId}}/items/{{itemId}}/createLink
      This is successful and returns a ShareURI.



      As User#2, we're using this API to get information about the item shared by User#1.
      https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem



      However, /driveItem returns a status code of 403 with the following body:



      HTTP 403
      {
      "error": {
      "code": "accessDenied",
      "message": "The sharing link no longer exists, or you do not have
      permission to access it.",
      "innerError": {
      "request-id": "73e65e0a-54b8-4722-9726-82297076276e",
      "date": "2018-11-07T16:20:03"
      }
      }
      }


      To prevent this 403 from happening, User#2 needs to load the ShareURI in a web browser. Once User#2 does this, then the request to the exact same URI
      https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem
      return 200OK and the expected json body.



      Why does User#2 have to load the ShareURI in a browser before being able to use Graph APIs on that ShareURI? Is there a workaround?










      share|improve this question













      As User#1, we're using this API to create a shared link:
      https://graph.microsoft.com/v1.0/drives/{{driveId}}/items/{{itemId}}/createLink
      This is successful and returns a ShareURI.



      As User#2, we're using this API to get information about the item shared by User#1.
      https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem



      However, /driveItem returns a status code of 403 with the following body:



      HTTP 403
      {
      "error": {
      "code": "accessDenied",
      "message": "The sharing link no longer exists, or you do not have
      permission to access it.",
      "innerError": {
      "request-id": "73e65e0a-54b8-4722-9726-82297076276e",
      "date": "2018-11-07T16:20:03"
      }
      }
      }


      To prevent this 403 from happening, User#2 needs to load the ShareURI in a web browser. Once User#2 does this, then the request to the exact same URI
      https://graph.microsoft.com/v1.0/shares/{{base64ShareURI}}/driveItem
      return 200OK and the expected json body.



      Why does User#2 have to load the ShareURI in a browser before being able to use Graph APIs on that ShareURI? Is there a workaround?







      file graph






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 7 at 17:00









      Mise

      142




      142





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194266%2ffiles-graphapi-do-return-403-until-the-file-is-loaded-by-the-user%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194266%2ffiles-graphapi-do-return-403-until-the-file-is-loaded-by-the-user%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()