我让 Mongoose-Auth 可以工作,但是我该如何对其进行一些自定义操作呢?
我按照 Mongoose-auth 上的说明进行操作,并使系统在我的 node.js 上运行: https://github.com /bnoguchi/mongoose-auth
facebook: {
everyauth: {
myHostname: 'http://localhost:3000'
, appId: 'YOUR APP ID HERE'
, appSecret: 'YOUR APP SECRET HERE'
, redirectPath: '/home'
}
}
因此,我使用 Mongoose-auth 执行此操作,并且能够通过 Facebook 进行连接。我想要的是在 Facebook 回击我后“做点什么”。现在,它只是将我重定向到“主页”,然后让用户登录。我想在它将我重定向到主页之前做一些事情。我该怎么办?
在 EveryAuth 中,我使用以下方法做到了:
.findOrCreateUser( function (session, accessToken, fbUserMetadata) {
// find or create user logic goes here
})
但我猜这在 mongoose-auth 中不可用......因为这不在文档中。
I followed instructions on Mongoose-auth and got the system working on my node.js: https://github.com/bnoguchi/mongoose-auth
facebook: {
everyauth: {
myHostname: 'http://localhost:3000'
, appId: 'YOUR APP ID HERE'
, appSecret: 'YOUR APP SECRET HERE'
, redirectPath: '/home'
}
}
So, I did this with Mongoose-auth, and I was able to connect through Facebook. What I want is to "do something" after Facebook hits me back. Right now, it just redirects me to "home", and logs the user in. I want to do something before it redirects me to home. How can I do taht?
In EveryAuth, I did it using this:
.findOrCreateUser( function (session, accessToken, fbUserMetadata) {
// find or create user logic goes here
})
But I'm guessing that's not available in mongoose-auth....since that's not in the docs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过
everyauth
访问的所有内容都可供mongoose-auth
使用。只需将您将在everyauth
中使用的链接方法从方法调用转换为mongoose-auth
配置中 everyauth 键中的键值即可:Everything you have access to with
everyauth
is available tomongoose-auth
. Just convert the chained method you would use ineveryauth
from the method call into a key-value in the everyauth key in yourmongoose-auth
configuration: