$http Auth Headers in AngularJS

前端 未结 8 746
闹比i
闹比i 2020-11-30 21:52

I have an angular application that is hitting a node API. Our backend developer has implemented basic auth on the API, and I need to send an auth header in my request.

8条回答
  •  悲哀的现实
    2020-11-30 22:21

    Try base64 encoding your user:password before you append it to "Basic", as in:

    headers: {
      'Authorization': "Basic " + auth64EncodedUserColonPass
    }
    

提交回复
热议问题