Skip to main content
Question

[.NET] Service Account with Editor Permissions Getting access_denied_insufficient_permissions

  • May 23, 2025
  • 1 reply
  • 32 views

Forum|alt.badge.img

I am using the Box V2.Core SDK to download files through the API.  I can successfully authenticate using JWT and read folder information as the service account, but when I attempt to dowload a file I get the following error:

'The API returned an error [Forbidden | 89g04ghb3n0n6h63.06d6fafa0530b85581d0753287ee989fa] access_denied_insufficient_permissions - Access denied - insufficient permission'

The service account is listed as a collaborator with editor permissions in the folder
BOX2_2qkYh7t0jZ9htlKqy1fS6A.png

Here is the associated app id for the service account: 1937532

Here is sample code for what we're doing:

var config = BoxConfigBuilder.CreateFromJsonString(jsonConfig).Build();
                var session = new BoxJWTAuth(config);
              var adminToken = await session.AdminTokenAsync();
                BoxClient adminClient = session.AdminClient(adminToken);
                BoxCollection<BoxItem> folderItems = await adminClient.FoldersManager.GetFolderItemsAsync(folderId, 100);
              var fileName = "Report 1" + ".csv";
              var filePath = "/folder1/";
                folderItems.Entries.ForEach(async folder =>
                {
                  if (string.Equals(folder.Name, "SHARED_FOLDER_NAME", StringComparison.OrdinalIgnoreCase))
                    {
                      BoxCollection<BoxItem> settlementFiles = await adminClient.FoldersManager.GetFolderItemsAsync(folder.Id, 1000);
                        settlementFiles.Entries.ForEach(async settlementFile =>
                        {
                            if (string.Equals(settlementFile.Name, fileName, StringComparison.OrdinalIgnoreCase))
                            {
                                if (!Directory.Exists(filePath))
                                {
                                    Directory.CreateDirectory(filePath);
                                }
                                var FileName = Path.Combine(filePath, fileName);
                                Stream fileContents = await adminClient.FilesManager.DownloadAsync(settlementFile.Id);

 


Wondering what I could be missing here? Thanks!

1 reply

Forum|alt.badge.img

hmm.... can you try reauthorizing the application in the admin console and try again?