我有一个非常奇怪的问题。让我解释一下发生了什么。
我是使用新的Stack Exchange应用创建的:
clientID xxxxx
name zyrafywchodzadoszafyqqq
OAuth Domain x.xx.xx.xxx
Application Website x.xx.xx.xxx
在我的nodejs应用程序中,我使用护照进行授权。
passport.serializeUser((user, done) => done(null, user))
passport.deserializeUser((obj, done) => done(null, obj))
const authOptions = {
clientID: '12345', // appID
clientSecret: 'aaaaaaaaa', // key
callbackURL: 'http://example.com/auth/stack-exchange/callback',
stackAppsKey: 'generatedkey', // key
site: 'zyrafywchodzadoszafyqqq'
}
const authStackExchange = (accessToken, refreshToken, profile, done) => {
process.nextTick(() => {
return done(null, profile)
})
}
passport.use(new StackExchangeStrategy(authOptions, authStackExchange))
/*
* ... some code of express conf
*/
app.get('/auth/stack-exchange', passport.authenticate('stack-exchange'))
// Callback url which is set in stackexchange api configuration
app.get(
'/auth/stack-exchange/callback',
passport.authenticate('stack-exchange', { failureRedirect: '/' }),
(req, res) => {
const user = req.user
user.initials = generateInitials(user.displayName)
// Save user to DB
r.db('stackboard')
.table('users')
.insert(user, { conflict: 'update' })
.run(connection, (err, result) => { if (err) throw err })
res.redirect('/')
}
)
不幸的是,我总是收到错误消息
{"error_id":400,"error_message":"No site found for name zyrafywchodzadoszafyqqq","error_name":"bad_parameter"}
节点v11.12.0
有什么想法吗?