Angular 2: Get Authorization header

前端 未结 3 1663
春和景丽
春和景丽 2020-12-16 02:45

in my App (Angular 2 / Ionic 2) I implemented my own login/authentication. Basically it works like this: On login, username and password is being validated by the PHP backen

3条回答
  •  孤城傲影
    2020-12-16 03:16

    That's not related to Angular. The problem is CORS limits headers by default and you do not see "Authorization" header when call CORS requests. So, adjust server to let it send Authorization header

    Access-Control-Allow-Headers must be provided in response of OPTIONS request (pre-flight).

    Access-Control-Expose-Headers must be provided in response of POST/GET request.

    Access-Control-Expose-Headers: Authorization

提交回复
热议问题