![](/img/trans.png)
[英]Passport for Google oauth20, middleware not in use, passport.initialize()
[英]Passportjs Google OAuth20 not working when deployed on digital ocean
我已經在數字海洋上設置了一個服務器,並在其上部署了我的 React 應用程序。 但是不知何故我的 Passportjs Google OAuth 不起作用,但是當我在本地運行它時它工作正常,它完美地重定向到回調 URL。
我以為問題出在節點版本上,但我也在服務器上更新了節點,但仍然沒有解決。Node -v 是 10.15
passport.serializeUser((id, done) => {
done(null, done)
})
passport.use(
new GoogleStrategy({
clientID: keys.google.clientID,
clientSecret: keys.google.clientSecret,
callbackURL: prod ? 'http://knowankit.com/myself-in-detail' : 'http://knowankit.com/myself-in-detail'
}, (request, accessToken, refreshToken, profile, done) => {
console.log('Testing ')
done(null, true)
})
)
該網站是https://knowankit.com 。 登錄屏幕 - https://knowankit.com/know-me 。 當您單擊用戶鎖定圖標時,它會在登錄后重定向到 google 登錄,它會重定向到主頁。 任何幫助將非常感激。 我已經堅持了一個月。
我能夠解決這個問題。 這是我的錯誤,因為在 Google OAuth 中localhost:3000
被添加為受信任的 URL,但是當它被部署時,部署的 URL 也需要被添加為受信任的 URL
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.