Very similar to this question, I am trying to get a specific value in the response header. It references a pass-through solution using Asynchronous Pluggable Protocol (APP) handlers, however the links are dead since the solution is quite dated.
Perhaps I am approaching this incorrectly.
Overview: I am extending an OAuth2 library that I have written in C++ (desktop app), which works well for the Google APIs, to now allow negotiation with Microsoft. As referenced on this site (under 'Redirect request after successful sign in'), the auth code is returned in the Location field of the response header. Using an HTTP debugger, I can see the value that was sent (see below).
When attempting to get IHTMLLocation interface from IHTMLDocument2, none of the properties contain the value that I can see using the HTTP debugger, and these calls succeed with various values even when the 'Location' field does not exist in the response headers (this is clearly not what is needed).
This is the only hang-up. All subsequent calls and requests, I use the WinHTTP APIs, and response headers are easily accessed. However this stage is still where the user can properly authenticate and authorize the app in a browser. I appreciate your time and help.
Update: The response looks similar to the following:
HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Location: urn:ietf:wg:oauth:2.0:oob?code=[VALUE]