Tag: oauth 2.0

authentication和callback代码之后没有获得访问令牌来使用elance-api

我正在尝试设置node.js应用程序使用OAuth2.0使用Elance API我正在使用passport.js连接到elance API,到目前为止我们能够得到正确的代码。 在使用api方法之前,没有获取访问令牌。 也尝试过构build策略,但不会通过用户configuration文件获取访问令牌来连接 我也尝试了相同的PHP,但也得到回拨代码后被吸 这是我通过策略得到的错误: failed to fetch user profile (status: 401 data: {"errors": [{"code":"missing_token","description": "Access token is required for this service"}]})

(Nodejs)Google oAuth2:缺less必需的参数:grant_type

使用Nodejs和Mikeal的请求来进行这个调用。 做所有的文档都说这里包括grant_type = authorization_code,但我仍然得到相同的错误。 查看屏幕截图,了解我传递的确切variables和方法。 以下是Grant_type首先显式设置的path /o/oauth2/token?grant_type=authorization_code&code=4%2F42sz3xxq4wGF9k9joYxRVop9mHi6.UpFaIUqZ_UQaaDn_6y0ZQNh869DgiwI&client_id=199079322117.apps.googleusercontent.com&client_secret=…&redirect_uri=…

Expressjs FBlogin不需要Passport.js或者everyauth

我一直在寻找几个小时,但没有护照或Everyauth无法find快递的Facebooklogin解决scheme。 有没有关于nodejs的服务器端oAuth 2.0 FBlogin的例子或教程? 还是有没有办法使用默认的快速会议,并让护照只处理初始authentication,而无需序列化/反序列化?

OAuth2服务器:无效或缺lessgrant_type参数

我有一个基于NodeJS的OAuth2服务器(使用oauth2-server模块)在我的局域网中启动。 我想用邮递员REST客户端来testing它,但我得到这个错误响应: { "code": 400, "error": "invalid_request", "error_description": "Invalid or missing grant_type parameter" } 这是我的请求configuration: 我试图通过URL发送参数,但我得到的错误: Method must be POST with application/x-www-form-urlencoded encoding 。 谢谢。

OAuth 2.0 OpenID连接环回和Keycloak

我无法从Loopback连接到Keycloak。 我一直在尝试使用keycloak-connect lib: https://github.com/keycloak/keycloak-nodejs-connect 这是我目前的server/boot/root.js module.exports = function (server) { var session = require('express-session'); var Keycloak = require('keycloak-connect'); var memoryStore = new session.MemoryStore(); var keycloak = new Keycloak({ store: memoryStore }); server.use(session({ secret: 'xxx', resave: false, saveUninitialized: true, store: memoryStore, })) server.use(keycloak.middleware({})); server.get('/*', keycloak.protect(), function (req, resp) { resp.send('hello'); }) };' 看起来很简单,但它陷入redirect循环。 我也试过交换 server.use(session 同 […]

在Google Contacts API版本3.0上使用oauth2检索刷新标记

我正在使用oauth2(node.js和connect-oauth库)连接到谷歌联系人API版本3.0 。 这样做,我得到一个回应,如: { access_token : "…", "token_typen": "Bearer", "expires_in" : 3600, "id_token": "…" } 我错过刷新令牌用于获取一个新的访问令牌,只要后者过期。 oauth2的选项 { host: 'accounts.google.com', port: 443, path: '/o/oauth2/token', method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', Host: 'accounts.google.com', 'Content-Length': 247 } } post-body'redirect_uri = http%3A%2F%2Flocalhost%2Foauth2callback&grant_type = authorization_code&client_id = CLIENTID&client_secret = CLIENTSECRET&type = web_server&code = 4%2F3gbiESZTEOjiyFPLUhKfE_a_jr8Q' 注意:我试图从类似的问题向request-post_body添加approval_prompt = force,但是这导致了一个错误 { statusCode: 400, […]

如何使用访问令牌在通过twitter.js护照login后validation用户

我需要在我的node.js应用程序上构build一个基于令牌的身份validation,用户可以使用他的Facebook或Twitter凭据login我的应用程序,并使用访问令牌获取资源。 这个postbuild议一旦通过Facebook或Twitter或其他authentication,每个请求使用访问令牌,并不需要会话 例如 GET / api / v1 / somefunction?token ='abcedf' 客户端从响应中获取访问令牌。 客户端使用token参数调用一些服务器API。 所以下面的代码是通过twitter授权用户,如果我的应用没有find我的用户信息,那么把用户信息存储到数据库中。 passport.use(new TwitterStrategy({ consumerKey: config.twitter.clientID, consumerSecret: config.twitter.clientSecret, callbackURL: config.twitter.callbackURL }, function(token, tokenSecret, profile, done) { console.log('TwitterStrategy /auth/twitter………….',profile.id, profile.displayName, profile.username, profile.emails[0], profile._json.avatar_url); userModel.findUserByQuery({ 'social.twitter.id': profile.id }, function (err, user) { if (!user) { console.log('twitter user not found'.red); userModel.createNewUser( { username:profile.username, email:profile.emails[0].value, img:profile._json.avatar_url, fullname:profile.displayName, […]

NodeJS OAuth2.0原则

最近我正在研究一个nodeJS项目,我正在考虑如何去实现我的移动应用程序的安全模块。 我曾经使用过C#项目中使用的OAuth 2.0协议。 在.NET中有两个很好的开源项目 https://github.com/thinktecture/Thinktecture.IdentityServer.v3 https://github.com/thinktecture/Thinktecture.AuthorizationServer 前者是支持联合身份validation的身份提供者,后者是OAuth 2.0提供者。 所以我决定为我的nodeJS应用程序使用相同的安全基础结构。 但据我所知,这些项目没有什么相同之处。 我发现了一些非常好的项目,这些项目还没有完成,但是一个好的开始: https://www.npmjs.org/package/node-oauth2-server https://github.com/domenic/restify-oauth2 另外,我遇​​到了一篇不错的文章,提出了一个在nodeJS中处理身份validation的好方法。 https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/和一个类似的答案在stackoverflow上的查询。 在网站和自有API之间进行身份validation 据我所知,expressJwt守卫我们的api,基本上会validation用户发送的访问令牌。 但我想更进一步,将令牌与应用程序特定的作用域相关联,与OAuth2.0协议类似。 因此,例如,我想分配一个写,读等范围,并expressJwt检查用户的令牌是否具有作为特定的API端点访问所需的范围。 如果您能提供一些关于如何处理这个问题的build议,我将不胜感激。

在节点JS中的FIWARE OAuth2身份validation

我试图通过Node JSvalidationFiware中的用户。 我已经创build了一个调用Oauth2的服务器代码,在运行它时,它会将您redirect到fiware页面,但是当loginFiware时什么都不显示,然后当检查/ user_info页面时,访问令牌为空 这里是我的config.js:$ var config=require('config'); config.idmURL = 'http://account.lab.fiware.org'; config.client_id = '2456'; config.client_secret = '12466'; config.callbackURL = 'http://localhost/login'; module.exports = config; $ oauth2.js文件来自https://github.com/ging/oauth2-example-client/blob/master/oauth2.js 调用Oauth2的代码如下:$ /** * Module dependencies. */ var express = require('express') , routes = require('./routes') , user = require('./routes/user') , http = require('http') , path = require('path'); var OAuth2 = require('./oauth2').OAuth2; var […]

无法授权通过Google API node.js SDK使用现有的访问令牌

有点背景第一; 我有一个基于PHP的应用程序处理Google OAuthstream程,并将生成的访问令牌存储在数据库中。 我可以在另一个PHP脚本中使用这个访问令牌,所以我不认为这个令牌已经过期。 当我尝试在node.js脚本中使用访问令牌时,问题出现了。 我总是从Google API中获取这个错误。 {[Error:Invalid Credentials] code:undefined,errors:[{domain:'global',reason:'authError',message:'Invalid Credentials',locationType:'header',location:'Authorization'}]} 我使用的node.js代码作为参考,如下所示: var CLIENT_ID = 'CLIENT_ID'; var CLIENT_SECRET = 'CLIENT_SECRET'; var REDIRECT_URL = 'REDIRECT_URL'; var oauth2Client = new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL); oauth2Client.setCredentials({ access_token: 'ACCESS_TOKEN' }); var analytics = google.analytics('v3'); analytics.management.accounts.list({ auth : oauth2Client }, function(err, resp) { console.log(err); console.log(resp); }); 我已经尝试在testing脚本中对access_token值进行硬编码,但仍然是相同的结果。 任何build议,欢迎!