请求使用Passport.js的requestVisibleActions权限,以便在Google+ API中插入片刻

我正在使用一个使用Passport.js进行Google Plusvalidation的Node.js应用程序。 在现在的后期阶段,我们已经引入了使用Google +的时刻添加活动。当他们在我们的网站上发布评论时,将其添加到用户的Google+订阅源中。 使用moment.insert发布需要一个名为requestvisibleactions的特殊权限。 passport.js文档没有说明如何在login时要求这样的权限。

我当前的身份validation处理程序设置是这样的:

 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' })); 

任何关于如何在passport.js身份validation过程中指定此页面中提到的requestvisibleactions权限的指针,

问题是passport.js不包括对requestvisibleactions支持,并且更新它的pull请求已经在那里一段时间了。 正如我们在Google+上讨论的那样, 使用nodejs客户端插入时刻您需要做两件事情:

1)应用这个补丁 ,让passport.js能够正确设置参数。

2)设置您希望能够作为passport.authenticate调用的一部分执行的操作

我没有testing过这个(因为我没有使用passport.js),但是一旦你完成了(1),你应该可以使用类似的东西来发布添加和审查的时刻:

 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' }));