使用Passport.js来请求requestVisibleActions权限以在Google+ API中插入广告 [英] Ask requestVisibleActions permission using Passport.js for moment insertion in Google+ API
问题描述
我正在开发一个使用Passport.js进行Google Plus身份验证的Node.js应用程序.现在,在稍后的阶段中,我们引入了使用Google+的 moment.insert 添加活动的功能.当用户在我们的网站上留下评论时,a>进入用户的Google+ feed.使用moment.insert
进行发布需要一个名为requestvisibleactions
的特殊权限. Passport.js文档没有说明在登录时如何请求此类权限.
I'm working on a Node.js application that uses Passport.js for authenticating with Google Plus. In a later stage now, we have introduced of adding activities using Google+'s moment.insert to the user's Google+ feed when they leave reviews at our site. Posting using moment.insert
needs a special permission called requestvisibleactions
. The passport.js documentation doesn't say how I can ask for such permissions while logging in.
我当前的身份验证处理程序设置如下:
My current auth handler setup is like this:
app.get('/auth/google', redirect, passport.authenticate('google', {
scope: ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/plus.moments.write'],
accessType: 'offline'
}));
此页面中提到的有关如何指定requestvisibleactions
权限的任何指示表示赞赏.
Any pointers on how I can specify the requestvisibleactions
permission mentioned in this page during passport.js authentication is appreciated.
推荐答案
问题是passport.js不包含对requestvisibleactions
的支持,并且更新它的请求请求已经存在了一段时间.正如我们在 Google+与nodejs客户端插入时刻上讨论的那样,您将需要做两件事:
The problem is that passport.js doesn't include support for requestvisibleactions
, and the pull request to update it has been sitting there for a while. As we discussed on Google+ insert moment with nodejs client You will need to do two things:
1)应用此补丁,该护照可以.js能够正确设置参数.
1) Apply this patch, which lets passport.js be able to set the parameter correctly.
2)将希望在通话中执行的操作设置为passport.authenticate
2) Set the action that you wish to be able to do as part of the call to passport.authenticate
我尚未对此进行测试(因为我不使用passport.js),但是一旦完成(1),您就应该可以使用类似的方式来发布添加和评论"时刻:>
I have not tested this (since I don't use passport.js), but once you have done (1), you should be able to use something like this to be able to post Add and Review moments:
app.get('/auth/google', redirect, passport.authenticate('google', {
scope: ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/plus.moments.write'],
accessType: 'offline',
requestVisibleActions: 'http://schema.org/AddAction http://schema.org/ReviewAction'
}));
这篇关于使用Passport.js来请求requestVisibleActions权限以在Google+ API中插入广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!