部署到 heroku 而无需使用护照回调重定向到本地主机
Deploy to heroku without redirecting to localhost with passport callback
我已将应用程序部署到 Heroku, however once you click 'log in with facebook', you are redirected to http://localhost:3000/#=。我尝试了以下方法(第一个是目前的位置):
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
function(accessToken, refreshToken, profile, done) {
process.nextTick(function () {
return done(null, profile);
});
}
));
但是当我部署时使用:
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "/auth/facebook/callback"
},
或
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "https://fivemincatchup.herokuapp.com/auth/facebook/callback"
},
它指向 facebook 并出现以下错误:
Given URL is not permitted by the Application configuration: One or
more of the given URLs is not permitted by the App's settings. It must
match the Website URL or Canvas URL, or the domain must be a subdomain
of one of the App's domains.
我是不是漏掉了一些很明显的东西?!
您是否将回调 URL 添加到应用的设置中?您必须在 Facebook 开发者应用程序设置中添加网站 URL 以允许 Facebook 回调任何特定网站。
应该在网站 URL 的基本设置或 "Valid OAuth redirect URIs"
的高级设置下
(另见 here)
我已将应用程序部署到 Heroku, however once you click 'log in with facebook', you are redirected to http://localhost:3000/#=。我尝试了以下方法(第一个是目前的位置):
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
function(accessToken, refreshToken, profile, done) {
process.nextTick(function () {
return done(null, profile);
});
}
));
但是当我部署时使用:
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "/auth/facebook/callback"
},
或
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "https://fivemincatchup.herokuapp.com/auth/facebook/callback"
},
它指向 facebook 并出现以下错误:
Given URL is not permitted by the Application configuration: One or more of the given URLs is not permitted by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
我是不是漏掉了一些很明显的东西?!
您是否将回调 URL 添加到应用的设置中?您必须在 Facebook 开发者应用程序设置中添加网站 URL 以允许 Facebook 回调任何特定网站。
应该在网站 URL 的基本设置或 "Valid OAuth redirect URIs"
的高级设置下(另见 here)