node.js - 护照-谷歌-oauth20 不能在生产中工作?
问题描述
它在开发中运行良好,但是当我尝试在生产中使用它时,一旦我选择了我的谷歌帐户,它就会继续加载而不重定向,直到连接超时。这是我的 googleStrategy 代码:
passport.use(
new GoogleStrategy(
{
clientID: keys.googleClientID,
clientSecret: keys.googleClientSecret,
callbackURL: "/auth/google/callback",
proxy: true
},
(accessToken, refreshToken, profile, done) => {
User.findOne({ googleId: profile.id }).then(existingUser => {
if (existingUser) {
done(null, existingUser);
} else {
new User({ googleId: profile.id })
.save()
.then(user => done(null, user));
}
});
}
)
);
我也尝试在回调 URL 中使用绝对路径,但它不起作用。
解决方案
推荐阅读
- neo4j - 在 cypher Neo4j 中处理嵌套的可选数据
- sql - oracle如何将各行的数据显示到一列?
- c - stdint.h include_next'd from stdint.h not found
- javascript - 如何防止表单提交,执行一些 JavaScript,然后在将数据传递到 NODE 时运行表单?
- angular - ngClass 最初不应用 css 类,仅在单击后
- firebase-cloud-messaging - FCM 到单个设备的最大消息速率
- c# - 参数 1:无法从 'System.Timespan' 转换为 'Instasharper.Classes.IRequestDelay'
- python - “它是如何找到 libpython 的?!” 谜
- c++ - 为函数 PlaySound 使用字符串变量
- c# - 如何将 SQL 查询转换为 LINQ