-
Notifications
You must be signed in to change notification settings - Fork 25.5k
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
Angular2 Http missed "Authentication" header in CORS preflight actual (second) request #13554
Comments
can u make the same request using plain hxr/fetch and compare results? |
Hello, In order to get an Oauth2 token by "password" grantType, you will also have to provide "ClientId" and "ClientSecret" which was implemented as "Authorization: Basic" header into a request message headers. the "OPTIONS" round
the "POST" round
|
I realize that I have had a typo in the original issue title: the "Authentication" should be "Authorization" |
@jing-zhou hello. it's still not very helpful without reproduction. asking again. have u tried to make the same request using plain xhr? Angular doesn't do anything with headers. |
well, I have to admit that I am not quite familiar with xhr. I am not directly using the xhr myself. but as I said, I have been using a npm package (client-oauth2) that is based on xhr. below are excerpts of my implements and that of the package till the final XMLHttpRequest call. and the result was a success as you can see from the above message print-out the initial calling from the web
the provider implementation:
the implementation of the getToken()
the implementation of _request()
the implementation of request(), and the final call to xhr
|
and following are my implementation with https the initial call from webpage
the provider implementation of display()
the implementation of sign(), which trace back to the previous provider
the implementation of sign() in the npm package
|
"Angular doesn't do anything with headers." but it is talking with xhr and handling the CORS session which is invisible to a calling client and happens automatically after the call "http.post(...)" |
Seems related to #11423 |
Please add a repro in a plunker. Otherwise we can not help. |
After hours of search I found a solution. Add |
@pkozlowski-opensource can be closed |
hi guys any body here i am facing a problem error 422 in Angular 2 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a ... (check one with "x")
Current behavior
Http missed the "Authentication" header in the actual (second) request of CORS preflight session. please see
https://forum.ionicframework.com/t/cr3-http-missed-authorization-header-in-cors-preflight-actual-request/73630
Expected behavior
Http should insert the "Authorization" header in the actual POST message headers after the success of "OPTIONS" round in a CORS preflight scenario
Minimal reproduction of the problem with instructions
set up a Restful service with CORS capacity; send a request with a "Authentication: Bear" token in the message; then try to extract the "Authentication" header from the received message at the server side
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Ionic2 RC3 -- emulated on Ubuntu 16.04 LTS Linux 4.4
Language: [TypeScript 2.0.3 ]
Node (for AoT issues):
node --version
= v4.6.2The text was updated successfully, but these errors were encountered: