API calls with JWT hanging

回答済み
新規投稿

コメント

10件のコメント

  • bvenu

    Sorry, here's the error message that I am getting when trying to create an app_user

     

    A first chance exception of type 'Box.V2.Exceptions.BoxException' occurred in Box.V2.dll

    Additional information: Bearer realm="Service", error="insufficient_scope", error_description="The request requires higher privileges than provided by the access token."

    0
    コメントアクション パーマリンク
  • kendomen

    I was wondering what User Access and Scope you gave your app.

    If you go to the dev console and edit your app, did you do something like this?

     

    app.png

     

    and then,

    go to admin console -> enterprise settings -> apps and Authorize App with your client_id.

    0
    コメントアクション パーマリンク
  • bvenu

    Thanks for the response. I am making progress.

     

    Earlier I gave User Access to "App Users" as per documentation and now selected "All Users". I also selected all options for scopes and advanced features.

     

    I reauthorized the app in the admin console.

     

    I am now able to create an app user but getting 403 for creating a folder withe the following message.

     

    A first chance exception of type 'Box.V2.Exceptions.BoxException' occurred in Box.V2.dll

    Additional information: {"type":"error","status":403,"code":"access_denied_insufficient_permissions","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Access denied - insufficient permission","request_id":"removed for privacy2583f38e2cb0f2"}

    0
    コメントアクション パーマリンク
  • kendomen

    So I had to get the user access token using the user_id as a parameter (instead of the enterprise_id) and use that APIConnection do stuff like create folder.  Are you using the enterprise access token or user access token.

    0
    コメントアクション パーマリンク
  • bvenu

    User access token.

     

    Here's my code.

    //using an app user that I created already

    var userToken = session.UserToken(app_user_id);

    var userClient = session.UserClient(userToken, app_user_id);

     

    var newFolder = await CreateAFolder(userClient);

     

    private static Task<BoxFolder> CreateAFolder(BoxClient userClient)

    {

    var folderRequest = new BoxFolderRequest

    {

    Description = "Test folder",

    Name = "My Test",

    Parent = new BoxFolderRequest { Id = "0" }

    };

    return userClient.FoldersManager.CreateAsync(folderRequest);

    }

     

    0
    コメントアクション パーマリンク
  • bvenu

     I need a little bit more help on this. I have tried to use the APIs as-user and got insufficient permissions error. I even setup the user as an admin in admin console and received the same error.

     

    When I used the enterprise access token, I was able to create the folder but it is not showing up in our folder structure. Is the folder created in a different environment? Not sure what am I missing.

    0
    コメントアクション パーマリンク
  • kendomen

    If you go to admin console -> console manager, you'll see your AppUser with the folder you created.

     

    I suspect that the other error is "as-user" calls may not work with the .NET SDK just like the Java SDK.

    0
    コメントアクション パーマリンク
  • bvenu

    When I create a folder with enterprise access token, who would be the owner of the folder?

    0
    コメントアクション パーマリンク
  • kendomen

    The App a.k.a Service Account
     

    https://github.com/kendomen/BoxJavaJWTExamples/blob/master/src/com/nike/box/UploadFileAsEnterpriseAdmin.java

     

    output:

    folder owner: KenJWT3
    file owner name: KenJWT3

     

     

    owner.png

     

    owner2.png

    0
    コメントアクション パーマリンク
  • bvenu

    ,

     

    Thank you so much for your responses.

     

    I finally was able to sort out the issue. I found that the .net SDK is not creating the user with appropriate permissions. When I used a different user which is setup correctly in Box, I was able to create folders.

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。