【发布时间】:2020-08-16 15:50:26
【问题描述】:
我在通过我的申请授权时遇到困难。 我的 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)
})
}
}
这是我的代码,我总是有未经授权的返回,当用户登录时,我的令牌保存在 AsyncStorage 中。
谁能帮帮我
【问题讨论】:
标签: reactjs react-native http-headers axios jwt