WebDavClient icon indicating copy to clipboard operation
WebDavClient copied to clipboard

MSAL claims based authentication not supported

Open Cpt-Falcon opened this issue 4 years ago • 1 comments

In the web client params, we should be able to pass an AuthenticationHeaderValue to support MSAL, for example the following from the Microsoft MSAL tutorial

            httpClient.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue(Constants.BearerAuthorizationScheme,
                                              accessToken);

Currently this Web DAV Client does not support Microsoft sharepoint since I can't pass the needed access token as part of the header. I might add this in myself if it would be desired.

Cpt-Falcon avatar Aug 18 '20 03:08 Cpt-Falcon

Hi @serp777 , It's possible to pass a custom HttpClient instance when creating WebDavClient.

WebDavClient CreateClientWithAuth(string accessToken)
{
    var httpClient = new HttpClient();
    httpClient.DefaultRequestHeaders.Authorization =
        new AuthenticationHeaderValue("Bearer", accessToken);
    return new WebDavClient(httpClient);
}

I hope it solves it.

skazantsev avatar Aug 22 '20 14:08 skazantsev