ReferenceError: [client_secret] is not defined. nodejs passport-fb
ReferenceError: [client_secret] is not defined. nodejs passport-fb
我试图了解 FB 登录的工作原理 API 并找到了一个教程,但我被卡住了。我不知道为什么会出现此错误:
C:\Users\DELAO\Desktop\lol\app.js:12
clientSecret: [App_Secret],
^
ReferenceError: fbbb55cd0c1c9886a8ec95d283863f is not defined
at Object.<anonymous> (C:\Users\DELAO\Desktop\lol\app.js:12:17)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
这是我找到的代码:
const express = require("express");
const passport = require("passport");
const FacebookStrategy = require("passport-facebook");
const app = express();
app.use(express.static("public"));
app.set("view engine", "ejs");
passport.use(new FacebookStrategy({
clientID: [APP_id],
clientSecret: [APP_secret],
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
function(accessToken, refreshToken, profile, done) {
User.findOrCreate(accessToken, function(err, user) {
if (err) { return done(err); }
done(null, user);
});
}
));
我已经在 FB 中创建了我的应用程序请帮忙!我很菜鸟
您必须将 '
添加到您的 clientSecret。
clientSecret: 'fbbb55cd0c1c9886a8ec95d283863f'
以你现在的情况,node.jsjs引擎认为是变量,不是字符串值
我试图了解 FB 登录的工作原理 API 并找到了一个教程,但我被卡住了。我不知道为什么会出现此错误:
C:\Users\DELAO\Desktop\lol\app.js:12
clientSecret: [App_Secret],
^
ReferenceError: fbbb55cd0c1c9886a8ec95d283863f is not defined
at Object.<anonymous> (C:\Users\DELAO\Desktop\lol\app.js:12:17)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
这是我找到的代码:
const express = require("express");
const passport = require("passport");
const FacebookStrategy = require("passport-facebook");
const app = express();
app.use(express.static("public"));
app.set("view engine", "ejs");
passport.use(new FacebookStrategy({
clientID: [APP_id],
clientSecret: [APP_secret],
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
function(accessToken, refreshToken, profile, done) {
User.findOrCreate(accessToken, function(err, user) {
if (err) { return done(err); }
done(null, user);
});
}
));
我已经在 FB 中创建了我的应用程序请帮忙!我很菜鸟
您必须将 '
添加到您的 clientSecret。
clientSecret: 'fbbb55cd0c1c9886a8ec95d283863f'
以你现在的情况,node.jsjs引擎认为是变量,不是字符串值