Closed cdpyx closed 1 month ago
复现步骤不够详细
好的,复现步骤为;
通过ouath获取access_token后,通过get请求会返回以上错误,经过试验用api调试工具和我编程语言的http请求均返回{"message":"Unauthenticated."},但是几次ouath请求后access_token未变,请求头{
'Authorization': 'Bearer ' + token,
'Accept': 'application/json',
'Accept-Language':'zh-CN'
}这里变量token就是access_token,假设access_token为12345那请求头应该是
{
'Authorization': 'Bearer 12345'
'Accept': 'application/json',
'Accept-Language':'zh-CN'
}
@tnqzh123
无法复现,而且正常情况下 OAuth 鉴权不通过应该会跳转到登录页面才对。
怀疑是你的 Web server 或者面板或者 WAF 什么的有问题。
无法复现,而且正常情况下 OAuth 鉴权不通过应该会跳转到登录页面才对。
怀疑是你的 Web server 或者面板或者 WAF 什么的有问题。
不是,是我在OAuth 鉴权后获取用户信息的时候报的
authorize
是「授权」,不是「鉴权」。
「鉴权」(authenticate)是指你拿着你的 token 去后端请求数据的时候,后端检查你是否拥有对应的访问权限的过程; 「授权」(authorize)是指用户同意你的应用从你的站点获取数据的过程; 是不一样的概念。
authorize
是「授权」,不是「鉴权」。「鉴权」(authenticate)是指你拿着你的 token 去后端请求数据的时候,后端检查你是否拥有对应的访问权限的过程; 「授权」(authorize)是指用户同意你的应用从你的站点获取数据的过程; 是不一样的概念。
好的谢谢,那是授权的时候问题
我没有在纠正你的用语。我的意思是,这个问题应该不是来自 Blessing Skin 本身的。
https://github.com/bs-community/blessing-skin-server/issues/624#issuecomment-2111055579
无法复现,而且正常情况下 OAuth 鉴权不通过应该会跳转到登录页面才对。
怀疑是你的 Web server 或者面板或者 WAF 什么的有问题。
后来我用其他语重构了以后具体的错误是:Oops! An Error Occurred The server returned a "405 Method Not Allowed". Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused. ` const options = { url: 'http://xxxx/oauth/token', form: { grant_type: grant_type, client_id: client_id, client_secret: client_secret, redirect_uri: redirect_uri, code: code } };
request.post(options, (error, response, body) => {
if (!error && response.statusCode == 200) {
const data = JSON.parse(body);
const access_token = data.access_token;
//res.status(200).send(`Access token: ${access_token}`);
const options = {
url: 'http://xxx/api/user',
headers: {
'Authorization': 'Bearer ' + access_token
}
};
request.post(options, (error, response, body) => {
if (!error && response.statusCode == 200) {
console.log(body);
res.status(200).send(`Access token: ${body}`);
} else {
console.error(error);
res.status(200).send(`Access token: ${body}`);
}`
点错了
@tnqzh123
#
Which version of Blessing Skin are you using?
最新版本
Which version of PHP are you using?
8.1
What browsers are you seeing the problem on?
Microsoft Edge
Which web server are you using?
Apache
What happened?
请求/api/user 会返回:{"message":"Unauthenticated."}但是token是刚刚获得的
Error Logs
No response
Steps to Reproduce
直接请求相关API