Tag: google authentication

如何validation服务器端的js节点的谷歌身份validation令牌?

我的前端应用程序使用Gmail帐户进行身份validation 。 validation成功后,我检索id_token ,并将其作为授权标头发送为承载令牌 。 例如http:// localhost:4000 / api 授权持票人token_id 在nodejs服务器端,我调用以下方法来validation令牌。 exports.verifyUser = function(req, res, next) { var GoogleAuth = require('google-auth-library'); var auth = new GoogleAuth(); var client = new auth.OAuth2(config.passport.google.clientID, config.passport.google.clientSecret, config.passport.google.callbackURL); // check header or url parameters or post parameters for token var token = ""; var tokenHeader = req.headers["authorization"]; var items = […]