Reactjs 在react native中发送请求头/授权axios.post

Reactjs 在react native中发送请求头/授权axios.post,reactjs,react-native,http-headers,axios,jwt,Reactjs,React Native,Http Headers,Axios,Jwt,我很难通过我的申请授权。 我的jwt代币 export const update_profile = ({ about, birthday, birth_location, residence_location, occupation, company_name, gender, marital_status, phone }) => { return dispatch => { dispatch( { ty

我很难通过我的申请授权。 我的jwt代币

export const update_profile = ({
  about,
  birthday,
  birth_location,
  residence_location,
  occupation,
  company_name,
  gender,
  marital_status,
  phone
}) => {
  return dispatch => {
    dispatch(
      {
        type: UPDATE_PROFILE
      }
    )
    const token = AsyncStorage.getItem('@token_jwt')
    let url = "/update_profile"
    Axios.post(`${SERVER}${url}`, {
      headers: {
        "Authorization": `Bearer ${token}`
      },
      "user": {
        "about": about,
        "birthday": birthday,
        "birth_location": birth_location,
        "residence_location": residence_location,
        "occupation": occupation,
        "company_name": company_name,
        "gender": gender,
        "marital_status": marital_status,
        "cellphone": phone
      }
    })
      .then((response) => {
        updateProfileSuccess(dispatch, response)
      })
      .catch((err) => {
        updateProfileError(err, dispatch)
      })
  }
}
这是我的代码,我总是有未经授权的返回,当用户登录时,我的令牌保存在异步存储中

有人能帮我一下吗?

标题需要作为第三个参数提供(不是第二个)

像这样

const头={
“内容类型”:“应用程序/json”,
'Authorization':'Bearer${token}`
}
常数数据={
“用户”:{
“关于”:关于,
“生日”:生日,
“出生地点”:出生地点,
“居住地点”:居住地点,
“职业”:职业,
“公司名称”:公司名称,
“性别”:性别,
“婚姻状况”:婚姻状况,
“手机”:手机
}
}
post(`${SERVER}${url}`,数据{
标题:标题
})
。然后((响应)=>{
...
})
.catch((错误)=>{
...
})
或者,您可以传递一个应该是对象的参数

。。。
常量选项={
方法:“POST”,
标题:标题,
数据:数据,
url:`${SERVER}${url}`,
};
axios(可选);