Ask requestVisibleActions permission using Passport.js for moment insertion in Google+ API

亡梦爱人 提交于 2019-12-09 04:27:27
Prisoner

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) Apply this patch, which lets passport.js be able to set the parameter correctly.

2) Set the action that you wish to be able to do as part of the call to passport.authenticate

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'
}));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!