Box Windows V2 SDK Collaboration Insufficient Permission
MTerry01 opened this issue · comments
I am using the Box Windows V2 SDK to create a folder, upload a file to that folder, and create a collaboration on that folder. I can create a folder and upload a file to that folder fine. The collaboration creation on that folder is throwing the error below. I am not sure if the admin and/or application permissions are being referred to in the error message.
The API returned an error [Forbidden | kge26jhhfel7ib83.1d1e37524e7a6b8c4d615d4bbd77dfc57] access_denied_insufficient_permissions - Access denied - insufficient permission
Stack Trace: at Box.V2.Extensions.BoxResponseExtensions.ParseResults[T](IBoxResponse`1 response, IBoxConverter converter)
at Box.V2.Managers.BoxResourceManager.<ToResponseAsync>d__11`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Box.V2.Managers.BoxCollaborationsManager.<AddCollaborationAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at NautilusBoxAPI.Controllers.BoxMainController.<Collaboration_Create>d__18.MoveNext() in C:\Projects\Projects\NautilusBoxAPI (SDK)\NautilusBoxAPI\Controllers\BoxMainController.cs:line 423
The code below is being used to create the collaboration on the folder:
//Box connection
var boxConfig = new BoxConfigBuilder(boxClientID, boxClientSecret, boxEnterpriseID, boxPrivateKey, boxjwtPrivateKeyPassword, boxjwtPublicKeyID).Build();
var boxJWT = new BoxJWTAuth(boxConfig);
var adminToken = await boxJWT.AdminTokenAsync();
BoxClient adminClient = boxJWT.AdminClient(adminToken, null, Boolean.Parse(request["collSendCreateNotification"].ToString().Trim()));
//Box collaboration request creation
BoxCollaborationRequest requestParams = new BoxCollaborationRequest() {
Item = new BoxRequestEntity() {
Type = BoxType.folder,
Id = request["folderID"].ToString().Trim(),
},
Role = request["collRole"].ToString().Trim(),
AccessibleBy = new BoxCollaborationUserRequest() {
Type = BoxType.user,
Login = request["users"].ToString().Trim()
}
};
BoxCollaboration collab = await adminClient.CollaborationsManager.AddCollaborationAsync(requestParams);
The insufficient permissions error comes from the backend service. Can you verify if you have correct scope enabled for you rapp to add that user as a collaborator?
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.
This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box .NET SDK and feel free to open another PR/issue at any time.