Tag: 谷歌加

Node.js OAuth2:获取Google+活动

从今天起,我无法通过向此url发送GET请求来检索我的Google+活动: https://www.googleapis.com/plus/v1/people/me/activities/public?key={API_KEY} 我得到一个401错误。 所以我试图使用node.js oauth2库来签署请求,包括预生成的用户令牌,但是我得到了同样的错误。 我的testing脚本的js代码是: var OAuth2 = require('oauth').OAuth2, GOOGLEPLUS_APP_ID = {APP_ID}, GOOGLEPLUS_APP_SECRET = {APP_SECRET}, accessToken = {USER_TOKEN}; var _oauth2 = new OAuth2(GOOGLEPLUS_APP_ID, GOOGLEPLUS_APP_SECRET, '', 'https://accounts.google.com/o/oauth2/auth', 'https://accounts.google.com/o/oauth2/token'); _oauth2.get('https://www.googleapis.com/plus/v1/people/me/activities/public?key={API_KEY}', accessToken, function (err, body, res) { if (err) { console.log('error:'); console.log(err); } else console.log(body); }); 我放置了相同的请求来获取基本的用户信息(url: https : //www.googleapis.com/oauth2/v1/userinfo )并正常工作。 你能帮我一下吗? 谢谢。

无需访问令牌即可调用API

我实现了Google+和Facebookloginbutton,并成功获取访问令牌。 但是我没有保存在我的服务器。 对于新业务,我需要获得授权用户的显示名称和图像。 对于Facebook的整合,我可以使用: https://graph.facebook.com/userId?fields=picture.width(720).height(720),name&access_token=APP_ID|APP_SECRET 有没有类似的方式让Google+ API在没有缺less访问令牌的情况下获取Google+用户的公开信息(图片,姓名,电子邮件等)?

使用访问令牌在节点中获取Google +用户个人资料

我正在尝试在Node中获取用户configuration文件的详细信息。 stream程是这样的,我有一个移动应用程序,为我生成令牌(通过谷歌加本地SDKauthentication),然后我把令牌发送到我的节点服务器,我想从谷歌获得有关用户的详细信息。 我尝试了以下(假设我有从客户端access_token ): var request = require('request'); request('https://www.googleapis.com/oauth2/v2/userinfo?access_token=' + access_token, function(err, res, body) { if (err) return callback(err); if (res.statusCode != 200) { return callback(new Error('Invalid access token: ' + body)); } else { var me; try { me = JSON.parse(body);} catch (e) { return callback(new Error('Unable to parse user data: ' + e.toString())); […]

Google+ Api获取用户电子邮件

我正在使用Google+ API创build注册。 当我的用户表中插入数据时,我想获取用户的电子邮件。 尝试这样做时出现错误。 我的代码如下所示: var API_KEY = 'A*****'; plus.people.get({ auth: API_KEY, userId: req.body.userID }, function (err, user) { if( err ) { res.json( JSON.stringify( err ) ); return; } console.log(user.emails); User.find({ where:{ social_id:req.body.userID, type: 2 } }).then( existingUser =>{ if( existingUser ) throw new Error('social_user_existing'); if(!existingUser){ User.build({ username: user.displayName, social_id : req.body.userID, social_token :req.body.token, […]

列出圈子时,Google+ Domains 403禁止

这是请求权限并尝试列出圈子的源代码,我想要做的是能够列出圈子的人,添加/删除圈子里的人,但是当我尝试做这件事时,我得到一个禁止的错误,我可以访问这些范围。 var express, router, nconf, OAuth2, oauth2Client, scopes, google; scopes = [ 'https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/plus.circles.read', 'https://www.googleapis.com/auth/plus.circles.write' ]; google = require('googleapis') nconf = require('nconf'); OAuth2 = google.auth.OAuth2; express = require('express'); router = express.Router(); oauth2Client = new OAuth2(CLIENT_ID, SECRET_ID, REDIRECT_URL); router.get('/', function(req, res) { var url = oauth2Client.generateAuthUrl({ access_type: 'offline', // 'online' (default) or 'offline' (gets refresh_token) scope: […]

没有Passport.js的Google +身份validation

我无法理解Google +的身份validation和授权的标准stream程,而无需使用Passport 需求: 没有passport.js (我知道这是简单的使用它,但我不想用它) 没有会议 (不会使用任何会议,我想保持无国籍) 当前架构: 我有一个REST API服务器,JWT(JSON Web令牌), 当用户进行POST /login时,用户将从我的服务器获得访问令牌 我的服务器,将检查用户名和密码,并返回访问令牌 这个令牌是我的服务器中将来的API查询所需要的 题: 我)我怎样才能取代我目前的身份validation与谷歌+? ii)当我使用Google +buttonlogin时,我在客户端有一个访问令牌,是否将令牌发送回我的服务器? iii)但是,我的服务器没有这个用户的信息?,我需要先在我的服务器中创build这个用户,当它发送一个访问令牌到我的服务器,我会检查这个用户是否有效,并返回与我的服务器访问令牌? (所以对于这个用户,我的服务器数据库上没有密码信息,这个来自google的访问令牌将被存储在我的服务器中) 四)我读了他们的文档https://developers.google.com/+/web/signin/server-side-flow他们正在使用会话,当用户第一次访问页面,我不想使用sessiosn 我想知道一般stream程,我自己可以实现的代码,我只是想知道通用架构来解决这个问题! 如果你能向我展示处理这个问题的一般概念,那将是非常棒的! 🙂