【发布时间】:2018-02-27 07:36:43
【问题描述】:
我正在使用 passport-google-auth 对 google 用户进行身份验证,它返回我用来获取 aws Cognito 凭据的 access_token,但它会引发错误:
NotAuthorizedException:登录令牌无效。不是有效的 OpenId Connect 身份令牌。
我的代码 sn-p:
passport.use(new GoogleStrategy(googleDeveloperDetails, getUserDetails));
app.get("/auth/google", passport.authenticate("google", { scope: ['email'] }));
var authGoogle = passport.authenticate("google", {
failureRedirect: "/auth/google"
});
app.get("auth/google/callback", authGoogle, controller.successRedirect);
getUserDetails = function(accessToken, refreshToken, params, profile, done) {
profile.token = accessToken;
done(null, profile);
}
googleDeveloperDetails = {
clientID: "google cleint ID",
clientSecret: "google client secret",
callbackURL: "https://localhost:3000/auth/google/callback",
profileFields: ["emails", "profile"]
}
【问题讨论】:
标签: node.js passport.js aws-cognito