Share users between nodeBB and KeystoneJS
-
Hello everyone,
i have used nodeBB a bit but am still a newbie(and am new here so hello everyone).
i have a keystoneJS project i am working on and i want to add to it some kind of community functionality.
So i found nodeBB, it looks awesome i am for sure using it for other projects.
So my question is: is it possible for nobeBB to share its users with a keystoneJS app? and so could someone please point me in the right direction?thx in advance Nikk
-
It is possible, through nodebb-plugin-session-sharing or an sso plugin
-
The recommended method of sharing sessions between two separate and distinct applications is through OAuth2. We recommend this approach because NodeBB maintains its own user records, so that we can keep track of user-related metrics and other data. Relying on another database would be tricky, prone to breaking, and quite possibly dangerous.
Luckily, it's quite straightforward to get things working with OAuth2!
The first step is getting your application to expose an OAuth2 endpoint. If you're running a Node.js based app, you can use a module called OAuth2orize.
Once that is set up, you'll want to take a look at the SSO plugin skeleton for customised OAuth deployments -- nodebb-plugin-sso-oauth. You'll take this plugin, fork it, and modify it to communicate with your OAuth endpoint.
Once everything is working properly, you should be able to register and log in/out via your web app.
-
The idea with shared sessions is that users don't have to log into both applications. If they log into one, they're automatically logged into both. They are a fully fledged user in both applications.
If you're asking whether session sharing would include something like comments being synced between NodeBB and your app, then no, that's not a feature of session sharing. Session sharing only handled the authentication.