unchase / Unchase.Odata.Connectedservice

:scroll: A Visual Studio extension for connecting to OData services with generating client-side C# proxy-classes
Apache License 2.0
44 stars 13 forks source link

Can't call metadata urls that require oAuth header #93

Open johnwc opened 1 year ago

johnwc commented 1 year ago

The oData service we use requires a Authorization: Bearer <access_token> header for authentication. Can the UI allow us to set temporary header values for metadata endpoint request?

johnwc commented 1 year ago

@unchase Any news? Seems like a simple thing to fix.

Also, could the request check to see if $metadata is already in the URL, if so don't append it to the url? We have oData URLs that we have to append a query string to the URL that contains an auth key.

LiQuick commented 1 year ago

Dear John,

Have you tried to add an own eventhandler which is called on the connected service SendingRequest2 event? With following code you can add your own headers before the httpmessage is send: e.RequestMessage.SetHeader("Authorization", "Bearer bladiebla");

Best regards, Rémy

johnwc commented 1 year ago

Dear Rémy,

I stated in the OP about the issue being in the UI of the generator, not the code it produces.

Best regards, John