ODataConnectedService
                                
                                
                                
                                    ODataConnectedService copied to clipboard
                            
                            
                            
                        Help needed to add odata endpoint with basic authorization to C# project.
Hi,
I'm asking for help on how to add an endpoint with Basic Authorization using OData Connected Service.
There are no samples or step by step guide on how to add the endpoint with Basic Authorization.
I've also searched the Issues tab for Authorization: Basic but no results show up.
I've added Authorization: Basic 
Reproduce steps






Expected result
Retrieved details
Actual result
Not retrieving details, 401
Hi @jerrywoo96
Perhaps, on the server side, additional request pledges are checked (for example, Host), which is why a 401 error is returned. See what other headers you are passing through Postman.
In other words, all the headers are replaced with the custom headers entered? For open services with no authorization, the plugin should have sent some headers of its own right? In order to be able to retrieve details. Like the one on docs.microsoft.com using trippin service.
@jerrywoo96 the headers are appended to the request. But they are trimmed before being added to the request. Each header should be on a separate line.
Looking at your screenshots, it's not immediately clear why it's not working as expected.
Is it possible that you have a typo in the header? Or does may trimming be affecting the header? Does your token end in whitespace by any chance?
@jerrywoo96 the headers are appended to the request. But they are trimmed before being added to the request. Each header should be on a separate line.
Looking at your screenshots, it's not immediately clear why it's not working as expected.
Is it possible that you have a typo in the header? Or does may trimming be affecting the header? Does your token end in whitespace by any chance?
I entered Authorization: Basic base64string as 1 line in the box and trimmed whitespace at both ends. The box width was small enough such that it wrapped around in the picture. Also hosting on a different port does not matter right?
@jerrywoo96 what do you mean by "hosting on a different port"? A different port from what?
@jerrywoo96 what do you mean by "hosting on a different port"? A different port from what?
The service is hosted on other ports than 443. Like https://foobar.com:12345/TEST-SVR/$metadata
@jerrywoo96 could you use a tool that can intercept the network traffic, maybe something like fiddler and inspect whether the connected service is actually sending the request to the server with the expected headers? Are there other headers that are being sent by postman that are not being sent by the connected service?
I am experiencing exactly the same problem. This applies to the Visual Studio extension and when using "odata-cli" tool. The result is the same in both cases - "The remote server returned an error: (401) Unauthorized." Executing Invoke-WebRequest against the same metadata endpoint and using the same header "Authorize: Basic ****' (used literally copy paste here) works just fine and returns the expected metadata xml.
Same problem! I have been trying to connect to Microsoft Dynamics 2018 web services. I can do this from a web browser, but I have not been able to get connected in Visual Studio 2022 using OData Connected Service for V1-V4. Really would like to get this working!
Hi fishmichael, it is a known issue and there is a PR that fixes it. Another thing is that this extension will work with only with OData versions V3-V4. Unchase extension seems to works for all versions though.