Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github取消通过access_token授权方式,使用Authorization授权,导致绑定Token,发布Blog等无法使用,不知道为啥作者没有维护。 #63

Open
chengfu05 opened this issue Dec 8, 2022 · 1 comment

Comments

@chengfu05
Copy link

chengfu05 commented Dec 8, 2022

github修改了授权的方式,取消通过access_token授权,详情查看:https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/

现在github建议:

废弃 curl "https://api.github.com/user/repos?access_token=my_access_token"

改为 curl -H 'Authorization: token my_access_token' https://api.github.com/user

需要修改的内容:/src/utils/request.js文件。

service.interceptors.request.use(
config => {
let token = store.state.token.token
if (token) {
let sp = "?"
if (config.url.indexOf("?") >= 0) {
sp = "&"
}
// 取消直接通过access_token的校验方式
// config.url = config.url + sp + "access_token=" + token
// 使用Authorization的授权
config.headers = {
'Authorization': 'token ' + token
}
}
return config
})

@kisekiremi
Copy link

在接口里改改,将原来的access_token改成在请求的header里加上:

Authorization: Bearer **********************************

Bearer空格后边为登录接口返回的Token。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants