Best of luck with the forum, @CatchThemAll! It's not released in Canada yet 😦
Link existing MySQL Database to NodeBB
Vân Hoàng last edited by
Hi guys, I've already had a website with more than 1000+ users. It was built in PHP with MySQL is database. I did some research but found no config for using MySQL in NodeBB so I'm kinda.. stuck here. I don't want my user have to re-create new account on the forum, it will be good to have a way both platform using the same database. Any advice for this situation? Please help me
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.
ah @scottalanmiller -- how nice of you to upvote a canned response post of mine
Short of using OAuth2, you could write your own app component to tie NodeBB into MySQL. One of the issues is that MySQL is a generic database so the format of your authentication easily won't match in some obvious way, so needs a customer connectors no matter what. Just adding another DB source for authentication would not solve your problem. It would have to be something that connects to your database and has the ability to understand your schema and has the ability to store all necessary additional schema changes there.