2014-10-19 33 views
0

我已经下载了oauth2orize provider code examplesample oauth client建议在文档中,我发现了以下错误:oauth2orize样品返回AuthorizationError:未授权

500 AuthorizationError: not authorized at validated (/Users/trevorallred/projects/pics/node-soa/oauth2orize/examples/all-grants/node_modules/oauth2orize/lib/middleware/authorization.js:131:36) at /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) at 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:262:26) at 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/oauth2orize/lib/server.js:285:5) at authorization (/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

与“鲍勃”登陆后,我发送到TH是错误页面。

我所做的唯一修改是在示例客户端中的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我看到this bug report之后,但它似乎没有改变任何行为。

module.exports = { 
    name: 'Example Consumer App' 
, icon: 'http://example.com/icon_64.png' 
, clientId: 'trevorclient' 
, clientSecret: 'kasdfasdfoq34t134tg109gqerg1gjc' 
}; 

回答

1

尝试文件更新OAuth的消费config.js这样:

module.exports = { 
    name: 'Example Consumer App' 
, icon: 'http://localhost:3000/icon_64.png' 
, clientId: 'abc123' 
, clientSecret: 'ssh-secret' 
}; 

的问题是,all-grants例子没有实际使用的数据块,但平坦的文件插图的目的。如果您导航到all-grants项目中的db/clients.js,您会看到那里列出的允许通过OAuth连接的客户端。