Angularjs set a authorization header

前端 未结 3 609
Happy的楠姐
Happy的楠姐 2020-12-16 18:01

I am trying to put an authorization header in my requests but it doesn\'t work.

I am using this:

var config = {headers: {
  \'Authorization\': token         


        
3条回答
  •  不知归路
    2020-12-16 18:54

    Authorization can't be plain.

    specify weather its a Basic or Bearer Authorization

    Something like

    $http.defaults.headers.common['Authorization'] = 'Basic ' + token;
    

    or

    $http.defaults.headers.common['Authorization'] = 'Bearer ' + token;
    

提交回复
热议问题