Closed gerarde closed 1 month ago
Turns out the issue may have been related to our custom IAuthenticationProvider and the fact that it was appending an Authorization header (with Bearer token) to SPO's _layouts/15/download.aspx
endpoint which authenticates with a guestaccesstoken.
Hi Gerarde,
Can you give some more details about how you solved this issue as I am facing exactly the same problem?
Thanks
We are having the same issue. Do you have some example code of what you did to get it working?
Thanks
What seems to be working for us providing an HttpProvider
which specifies AllowAutoRedirect=true
when initializing the OneDriveClient
:
return new OneDriveClient($"https://{Settings.OneDriveTenant}-my.sharepoint.com/_api/v2.0", new AuthenticationProvider(GetAccessToken), new HttpProvider(new HttpClientHandler { AllowAutoRedirect = true }, true));
Our testing suggests it works with our particular uses of the library, but I'm not certain whether this causes any side effects.
Are other people using custom AuthenticationProviders? Because our AuthenticationProvider does the insertion of the Authorization HTTP header, I thought this might have been an issue specific to us.
Works! Thank you, much appreciated!
Worked for us too!! Here is the code we used:
var adalAuthProvider = new AdalAuthenticationProvider(
this.AadClientId,
this.AadReturnUrl);
this.oneDriveClient = new OneDriveClient(this.AadTargetUrl + "/_api/v2.0", adalAuthProvider, new HttpProvider(new HttpClientHandler { AllowAutoRedirect = true }, true));
authTask = adalAuthProvider.AuthenticateUserAsync(this.AadTargetUrl);
try
{
await authTask;
}
Reopening this since it looks like it's not just us -- it looks like the library (or the upstream Microsoft.Graph libs) is incompatible with a recent deployment of SPO.
Troubleshooting advice:
_layouts/15/download.aspx
reproduces the issue. Removing it solves the problem.HttpClientHandler
Proxy
/UseProxy
) and toggling AllowAutoRedirect
on/off demonstrates problem fully.Question for all: Does anyone know how to find a list of updates for O365/SPO/OneDrive and when they were deployed (i.e., release notes?)? MS Tech Support was completely unhelpful in helping to troubleshoot this problem.
Here's a link to the release notes for the OneDrive rollout they did on 12/7.
The notes for Graph changes are available here: https://graph.microsoft.io/en-us/changelog#
My application is using 1.x sdk and it is affected by this problem. I am not sure whether 2.x sdk also has the issues.
Gerard Escalante, But setting the "AllowAutoRedirect = true" may fail some other calls which requires authorization header.
Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #259 for more information
I'm writing a C# web app (ASP.NET Core 1.0) which uses the OneDrive C# SDK to access a OneDrive for Business account. It has code to upload/download files using the C# SDK.
The problem is that code to download a (which has been working for months) has mysteriously stopped working.
Notes:
I know this isn't an issue with the SDK, but have no idea where I can get help from Microsoft. I do have an MSDN subscription, and am willing to use a support incident to figure this out, but nobody in the support center can seem to figure out how to route my call. I've spent hours talking to SharePoint Online/OneDrive For Business support to no avail.
Any assistance would be much appreciated... thanks!