Please provide the following (and please check them off the list with [x]) before submitting this issue:
Description
I'm using SDK .Net in an ASP.Net Core 2.2 project.
Requests have to pass through a Http proxy, so I provided a HttpProvider with proxy configuration to the GraphServiceClient to do that.
The below code was working in 1.12.0 but not working anymore in 1.13.0.
I don't know if I'm doing something wrong.
Expected behavior
I don't know if it's an issue or a change of the way to use GraphServiceClient with DelegateAuthenticateHandler and HttpProvider
If now provided HttpProvider must have the AuthenticationProvider, the following constructor become useless :
GraphServiceClient(DelegateAuthenticateHandler, HttpProvider)
Constructor with HttpProvider does not need AuthenticationProvider
GraphServiceClient(HttpProvider)
Actual behavior
Microsoft.Graph.ServiceException: Code: invalidRequest
Message: Authentication provider is required before sending a request.
at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at Microsoft.Graph.GraphServiceUsersCollectionRequest.GetAsync(CancellationToken cancellationToken)
at ADIS.WebApi.Common.Helpers.MicrosoftGraphManagerUsingSDK.GetUser(String upn, Expression`1 selectExpression)
Steps to reproduce the behavior
ASP.Net Core 2.2 WebApi
Microsoft.Graph 1.13.0
Proxy is not mandatory to reproduce error, just using a httpProvider without authentication handler
Working in 1.12.0 but not in 1.13.0
HttpProvider httpProvider = new HttpProvider();
// Init MS Graph client
_graphClient = new GraphServiceClient(
new DelegateAuthenticationProvider(requestMessage =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", _accessToken);
return Task.FromResult(0);
}), httpProvider);
Then make any request
Working in 1.12.0 and in 1.13.0
I'm able to fix it by moving the authentication handler to HttpProvider:
HttpProvider httpProvider = new HttpProvider(
new DelegateAuthenticationProvider(requestMessage =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", _accessToken);
return Task.FromResult(0);
})
);
// Init MS Graph client
_graphClient = new GraphServiceClient(null, httpProvider);
Then make any request
Edit : seems related to this commit : e97039d#diff-ae7fba9d494bd6e152a9340223a114c7
Please provide the following (and please check them off the list with [x]) before submitting this issue:
Description
I'm using SDK .Net in an ASP.Net Core 2.2 project.
Requests have to pass through a Http proxy, so I provided a HttpProvider with proxy configuration to the GraphServiceClient to do that.
The below code was working in 1.12.0 but not working anymore in 1.13.0.
I don't know if I'm doing something wrong.
Expected behavior
I don't know if it's an issue or a change of the way to use GraphServiceClient with DelegateAuthenticateHandler and HttpProvider
If now provided HttpProvider must have the AuthenticationProvider, the following constructor become useless :
Constructor with HttpProvider does not need AuthenticationProvider
Actual behavior
Steps to reproduce the behavior
ASP.Net Core 2.2 WebApi
Microsoft.Graph 1.13.0
Proxy is not mandatory to reproduce error, just using a httpProvider without authentication handler
Working in 1.12.0 but not in 1.13.0
Then make any request
Working in 1.12.0 and in 1.13.0
I'm able to fix it by moving the authentication handler to HttpProvider:
Then make any request
Edit : seems related to this commit : e97039d#diff-ae7fba9d494bd6e152a9340223a114c7