我已经下载了文档中建议的oauth2orize提供程序代码示例和样本oauth客户端,并得到了以下错误:
500 AuthorizationError:在/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/oauth2.js:180:14 at Object.exports.findByClientId (/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/db/clients.js:24:10)的验证的AuthorizationError上未授权在exports.authorization.res.render.transactionID (/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/oauth2.js:174:16) at /Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/node_modules/oauth2orize/lib/middleware/authorization.js:167:9 at pass (/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/node_modules/oauth2orize/lib/server.js:26226)在pass (/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/node_modules/oauth2orize/lib/server.js:280:9) at pass (/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/node_modules/oauth2orize/lib/server.js:271:11) at Server._parse (/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/node_modules//lib/server.js:285:5)在授权(/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/node_modules/oauth2orize/lib/middleware/authorization.js:118:12)中
我在这里运行客户端:http://localhost:3002/ -我点击链接到“连接示例-oauth2orize”
它将我重定向到提供者:http://localhost:3000/login
在用"bob“登录后,我被发送到这个错误页面。
我所做的唯一修改就是对示例客户机中的oauth-config.js进行修改。
'use strict';
module.exports = {
provider: {
protocol: "http",
host: "localhost:3000",
profileUrl: "/api/userinfo"
},
consumer: {
protocol: "http",
host: "localhost:3002"
}
};在我看到这个错误报告之后,我试着修改oauth config.js,但是它似乎并没有改变任何行为。
module.exports = {
name: 'Example Consumer App'
, icon: 'http://example.com/icon_64.png'
, clientId: 'trevorclient'
, clientSecret: 'kasdfasdfoq34t134tg109gqerg1gjc'
};发布于 2015-01-18 04:30:13
尝试更新您的oauth-consumer-config.js文件如下:
module.exports = {
name: 'Example Consumer App'
, icon: 'http://localhost:3000/icon_64.png'
, clientId: 'abc123'
, clientSecret: 'ssh-secret'
};问题是,all-grants示例实际上并不使用DB,而是使用平面文件进行说明。如果导航到项目中的all-grants db/clients.js,您将看到这里列出的客户机允许通过OAuth进行连接。
https://stackoverflow.com/questions/26453146
复制相似问题