I have a ui which I manage authorization via Okta. So for a user to access the box files it creates a temporary shared link that expires after an hour. This link is opened by the UI and this has worked great for past month and lets me manage more advance authorization and such on my end rather than adding people to our folders directly. However, out of no where my code stopped working and its drawing an error at the creating the shared link and the stack trace doesnt give much info. Here is my code:
public async Task<string> GetSharedLink(string Id)
{
try
{
BoxClient adminClient = _session.AdminClient(await token.FetchTokenAsync());
var sharedLinkParams = new BoxSharedLinkRequest()
{
Access = BoxSharedLinkAccessType.company,
Permissions = new BoxPermissionsRequest
{
Download = true,
Edit = true,
},
UnsharedAt = DateTimeOffset.Now.AddHours(1)
};
BoxFile file = await adminClient.FilesManager.CreateSharedLinkAsync(Id, sharedLinkParams);
return file.SharedLink.Url;
}
catch(Exception ex)
{
return null;
}
}
The stack trace shows the error at CreateSharedLinkAsync and indicates a bad request:
The API returned an error [BadRequest | 6jf7nshr0sh5vfzn.0680355565db538d69880cbc9aba68811] bad_request - Bad Request
Any ideas why this would just start happening? The files are there and other api endpoints work such as pointing the thumbnails and representations and download links.