Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set Request headers for IDownStreamWebAPI #1063

Closed
parwejp opened this issue Mar 15, 2021 · 8 comments
Closed

Ability to set Request headers for IDownStreamWebAPI #1063

parwejp opened this issue Mar 15, 2021 · 8 comments

Comments

@parwejp
Copy link

parwejp commented Mar 15, 2021

Dear Team,

I am not able to find out how to send request headers while using get requests on iDownStreamWebAPI. I recently got an error while calling MS graph api to add "ConsistencyLevel = eventual" header.

Microsoft Graph advanced queries Header

Describe alternatives you've considered
Have switched to ITokenAquisition implementation for now but would be nice to use IDownStreamWebAPI for it. As @rollandjb mentioned here would be possible to set request headers with pooled HttpClient with proper isolation. I am no expert but creating HttpRequestMessage could be quick fix.

If it is implemented already, could you please be kind enough to point me out to documentation?

@jennyf19 : Created the feature request as requested.

@parwejp parwejp added the enhancement New feature or request label Mar 15, 2021
@jmprieur jmprieur added the P1 label Jun 2, 2021
@jmprieur jmprieur added this to the 1.13.0 milestone Jun 2, 2021
@jmprieur
Copy link
Collaborator

jmprieur commented Jun 3, 2021

MSAL.NET 4.32.0 now supports WithExtraHttpHeaders on AcquireTokenXXX

@parwejp
Copy link
Author

parwejp commented Jun 3, 2021

Perfect. Thanks.

@parwejp parwejp closed this as completed Jun 3, 2021
@jmprieur jmprieur reopened this Jun 3, 2021
@jmprieur
Copy link
Collaborator

jmprieur commented Jun 3, 2021

@parwejp reopening because although this is supported by MSAL.NET, we still need to add support in Microsoft.Identity.Web

@jmprieur
Copy link
Collaborator

jmprieur commented Jun 7, 2021

Design proposal:

  • In TokenAcquisitionOptions, add a new ExtraHttpHeaders of type [IHeaderDictionary] that will be passed-in to the calls to MSAL.NET (using WithExtraHttpHeaders)
  • In DownstreamWebApiOptions, add a new member ExtraHttpHeaders of type IHeaderDictionary. This will be used to add headers to the HttpRequest used to call the web API

Note that the two properties apply to different calls: the first during the token acquisition, and the second for the web API.

@jmprieur jmprieur added the Spec'd label Jun 7, 2021
@jennyf19 jennyf19 modified the milestones: 1.13.0, 1.14 Jun 11, 2021
@jennyf19 jennyf19 modified the milestones: 1.14, 1.13.1, 1.15 Jun 23, 2021
@jmprieur jmprieur added P2 and removed P1 labels Jul 14, 2021
@jennyf19 jennyf19 removed this from the 1.14.1 milestone Jul 15, 2021
@jguldal
Copy link

jguldal commented Oct 7, 2021

Is there any workaround for adding HTTP headers to the downstream request until this feature is implemented?

@jennyf19
Copy link
Collaborator

Duplicate of #891

@jennyf19 jennyf19 marked this as a duplicate of #891 Dec 23, 2021
@jennyf19
Copy link
Collaborator

jennyf19 commented Jan 8, 2022

Included in the [1.22.0 release](https://github.com/AzureAD/microsoft-identity-web/releases/tag/1.22.00

@jennyf19 jennyf19 closed this as completed Jan 8, 2022
@jennyf19 jennyf19 added this to the 1.22.0 milestone Jan 8, 2022
@jmprieur
Copy link
Collaborator

jmprieur commented Jan 8, 2022

@parwejp, @jguldal : the documentation is Customizing the headers (or the HttpMessageRequest) when using IDownstreamWebApi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants