首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >oauth2orize示例返回AuthorizationError:未授权

oauth2orize示例返回AuthorizationError:未授权
EN

Stack Overflow用户
提问于 2014-10-19 17:12:05
回答 1查看 503关注 0票数 0

我已经下载了文档中建议的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进行修改。

代码语言:javascript
复制
'use strict';

module.exports = {
        provider: {
                protocol: "http",
                host: "localhost:3000",
                profileUrl: "/api/userinfo"
        },
        consumer: {
                protocol: "http",
                host: "localhost:3002"
        }
};

在我看到这个错误报告之后,我试着修改oauth config.js,但是它似乎并没有改变任何行为。

代码语言:javascript
复制
module.exports = {
  name: 'Example Consumer App'
, icon: 'http://example.com/icon_64.png'
, clientId: 'trevorclient'
, clientSecret: 'kasdfasdfoq34t134tg109gqerg1gjc'
};
EN

回答 1

Stack Overflow用户

发布于 2015-01-18 04:30:13

尝试更新您的oauth-consumer-config.js文件如下:

代码语言:javascript
复制
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进行连接。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26453146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档