Tag: oauth

为什么在使用Passport / Node Express的OAuth2Strategy进行身份validation时遇到TokenError?

我试图与Express(4)一起使用Passport JS的OAuth2Strategy。 我redirect到login后,它成功导航回到我的callbackurl,在这一点上,我得到以下错误: TokenError: Invalid client or client credentials at OAuth2Strategy.parseErrorResponse (/www/az-avatarz-server/node_modules/passport-oauth/node_modules/passport-oauth2/lib/strategy.js:298:12) at OAuth2Strategy._createOAuthError (/www/az-avatarz-server/node_modules/passport-oauth/node_modules/passport-oauth2/lib/strategy.js:345:16) at /www/az-avatarz-server/node_modules/passport-oauth/node_modules/passport-oauth2/lib/strategy.js:171:43 at /www/az-avatarz-server/node_modules/passport-oauth/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18 at passBackControl (/www/az-avatarz-server/node_modules/passport-oauth/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:124:9) at IncomingMessage.<anonymous> (/www/az-avatarz-server/node_modules/passport-oauth/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:143:7) at IncomingMessage.EventEmitter.emit (events.js:117:20) at _stream_readable.js:919:16 at process._tickDomainCallback (node.js:463:13) 我的护照configuration如下: passport.use("avatarz", new OAuth2Strategy({ authorizationURL: authorizationURL, tokenURL: tokenURL, clientID: clientID, clientSecret: clientSecret, callbackURL: callbackURL }, function (accessToken, refreshToken, profile, done) { User.find({ […]

OAuth2orizeloginstream程无限循环

希望获得为我的网站设置的OAuth2端点。 我在OAuth服务器上使用OAuth2orize,在客户端服务器上使用passport-oauth。 我几乎逐字地使用oauth2orize的例子来使它工作。 当我开始loginstream程时,它会将我发送到login页面(到目前为止),我login并将其发送给对话框(也是好的),然后当我单击允许时,它只是使我回到相同的一遍又一遍的页面(允许/拒绝对话框)。 任何人有什么想法我做错了? 我知道这实际上是把我送回到我的应用程序(用代码,我的应用程序应该交换一个标记),但是它似乎只是让我回到对话框:

如何在没有Cookie的情况下在SPA中使用第三方authentication服务?

在我的Web应用程序中,恰好是一个SPA(单页应用程序),我有OpenID和OAuth2.0客户端用于使用第三方服务进行用户validation。 即Google(OpenID),Yahoo(OpenID),Windows Live(OAuth2)和Facebook(OAuth2)。 现在,我已经设置了一个令牌端点,用于交换不记名令牌的用户凭证。 这里的目标是通过在SPA的所有请求中设置的授权标头replaceCookie。 为此,我使用OAuth2.0客户端密码身份validation策略和“密码”grant_type根据凭据(oauth2orize + passport-oauth2-client-password)对用户进行身份validation。 我想知道 : 如何使用第三方服务validation的用户继续使用令牌承载validation方法? OAuth2.0规范中有什么处理这种情况? 这种实现的常见做法是什么?

在process._tickCallback(node.js:419:13)处,NodeJs,500未能获得访问令牌(错误:连接ECONNREFUSED)

我正在使用护照GoogleStrategy来validation用户,但我得到以下错误。 你能帮我么 ? 码 passport.use(new GoogleOAuth2Strategy({ clientID : configAuth.googleAuth.clientID, clientSecret: configAuth.googleAuth.clientSecret, callbackURL: configAuth.googleAuth.callbackURL, scope: ['profile', 'email', 'openid'], passReqToCallback : true }, function(token, refreshToken, profile, done) { // User.findOne won't fire until we have all our data back from Google process.nextTick(function() { console.log(profile.id); User.findOne({ 'google.id' : profile.id }, function(err, user) { if (err) return done(err); if […]

使用Mocha在NodeJS中进行OAuthstreamtesting

我正在尝试创build和使用reddit的OAuthstream来validation用户的应用程序,并检索将被我的应用程序用于进一步的reddit api调用的访问令牌。 当他们使用API​​调用“/login”,客户端被redirect到reddit的OAuth页面,他们将login和接受或拒绝。 然后,他们将被redirect到OAuthcallbackURL,NodeJS将获取令牌(或错误)并继续。 我可以testing这个stream程并在testing中获得访问令牌的最佳方式是什么,以便我可以使用它来进一步testing调用?

来自nodejs中的oauth2-server错误的REST接口

我正在使用nodejs( npm )的oauth2-server插件,并具有以下configuration: app.oauth = oauthserver({ model: oauth.model, grants: ['password'], debug: false }); 当我GET / oauth /令牌没有发送任何参数(没有头,没有查询,没有正文),我得到以下错误为500 – 内部服务器错误: { "name": "OAuth2Error", "message": "Invalid or missing grant_type parameter", "headers": { "Cache-Control": "no-store", "Pragma": "no-cache" }, "code": 400, "error": "invalid_request", "error_description": "Invalid or missing grant_type parameter" } 消息中的代码表示400(错误的请求),我想发送的消息不是500而是400响应。 此外,我得到我的控制台上的错误,即使我有debug:false作为configuration。 我怎样才能改变呢?

Google OAuth 2.0服务器到服务器,无法获取令牌

我想从Google Play服务器获取订阅者信息,但我甚至无法通过令牌响应阶段。 我检查了相关的答案,alignment可能的谷歌服务器时间,但我找不到解决scheme。 我还附加了服务器端的javascript下面总是变成响应string; “上传成功!服务器响应: {“error”:“invalid_grant”,“error_description”:“Bad Request”}“ 提前致谢。 function myFunction() { var googleRequest = require('request'); var googleUrl = "https://www.googleapis.com/oauth2/v3/token"; var private_key = "xxx";//intentionally xxx'ed for security and clarity var s1 = JSON.stringify({"alg":"RS256","typ":"JWT"}); var now = new Date().getTime(); var s2 = JSON.stringify({ "iss":"xxx@developer.gserviceaccount.com", "scope":"https://www.googleapis.com/auth/prediction", "aud":"https://www.googleapis.com/oauth2/v3/token", "exp":now + 3600, "iat":now }); function base64(input) { return new Buffer(input, […]

如何使用Express和oAuth2让用户在Angular的多个设备上login?

我试图让用户login到多个设备相同的用户名。 在后端,我们使用oAuth2 JWT令牌通过oauth2orize npm包使用node / express rest api。 目前,我们的后端身份validation工作的方式是用户login,发送一个JWT令牌和一个JWT刷新令牌。 当用户注销时,令牌无效。 我们遇到的问题是用户将在一台计算机上login,然后login到另一台计算机上的相同帐户。 当第二次login发生时,给用户一个新的令牌和刷新令牌。 现在,当用户返回第一台计算机时,刷新令牌无效,导致用户退出。 一个解决办法是我们试图坚持sessionId在一个cookie,但Angular似乎返回一个新的sessionId每个请求。 以下是请求的一个例子。 — session — l3s-kZCEUaz8TYhElVtARIwbl6PKTm_o { cookie: { path: '/', _expires: Fri Aug 05 2016 00:23:44 GMT+0000 (UTC), originalMaxAge: 31449600000, httpOnly: true } } — session — hN961RAc2YSlmzngr3R6zXuJnp4cFF_P { cookie: { path: '/', _expires: Fri Aug 05 2016 00:23:46 GMT+0000 (UTC), […]

PassportJS:BasicStrategy vs LocalStrategy?

看着许多PassportJS的例子,我对使用BasicStrategy感到困惑。 有些人使用它进行用户名/密码authentication,其他用户使用clientID / clientSecretauthentication,而有些人完全不使用LocalStrategy。 BasicStrategy的正确目的是什么? 不应该只使用ClientPasswordStrategy来通过ID /密钥来validation客户端吗?

使用trello OAuth的授权路由,然后在哈希标签#

根据参考链接https://developers.trello.com/authorize ,我select使用授权路由在Trello上实现OAuth的第一种方式。 涉及的url请求是https://trello.com/1/authorize?return_url=http://xxx/union/callback/trello&namae=xxx&key=xxx&callback_method=xxx&scope=read&expiration=30days 最后,程序在浏览器位置停止,地址为http://xxx/union/callback/trello#token=a1418eb97b298edc9a7a83fb85107bad4d2861cf46ac897037002aff778c3927 。 在我看来,代币应该在“?”之后返回 代替 ”#”。 因为“#”后的string不会被发送到服务器。 对于这个问题,这是一个trello的OAuth的错误,或者我可以做任何事情继续?