Database integration, permissions and custom routes in plugin

Plugin Development
  • I'll define my requirements in the form of conversation.

    • A link will be generated and given to the user within Minecraft.
    • The user can click this link, and if the user is authenticated and has the necessary permissions, then he/she can link their in-game Minecraft account with their forum account.

    I understand how to achieve this, my concern is getting the data and specifying custom routes and permissions.

  • Using only the currently logged in nodebb user and minecraft player.

    Two routes needed:

    • Server-only route: POST route. Requires a unique key parameter. Only the forum and the minecraft server know the key. e.g. /mc/link?key=key
    • User route: GET route. Used to link accounts, requires a UUID and a unique player key. e.g. /mc/link/:uuid/:key

    Minimum two DB keys need:

    • {uuid}:key String key, stores the unique player key for the UUID. (Could also be a hash to store additional data.)
    • user:{uid}:uuid String key, stores the UUID linked to the user. (Could also be stored on the user hash, or made into a set for multiple linkings.)


    • Minecraft player types a command.
    • Server users server-only route to tell the forum it needs a registration link. Sending the unique key to verify the request is valid.
    • Forum creates a unique player key and stores it in the DB, then sends the player key to the server.
    • Server gives a link to the player, using the unique player key and the players' UUID.
    • User visits link, if the user is logged in, and the uuid-key pair matches what is already in the DB, then the accounts are linked, using additional DB entries.
    • The player key is deleted.


    • The player key should expire relatively quickly, like 5 minutes.
    • Invalid requests to the user route should be monitored and blocked after a low threshold, like 3 tries.
    • NodeBB middleware already validates the logged in user, which is why we do no additional checks.


    On the last line in the diagram, I send a confirmation message, but we can't actually do this because we have not established a persistent connection. You could solve this by either having an http server on the server, or creating a socket connection to the forum.

    Or you could use Minecraft-Integration 😉

Suggested Topics

  • 0 Votes
    1 Posts


    I wrote a plugin for OpenLDAP.
    It overrides the default login and falls back to local login if the user is not found in LDAP.
    It also creates all groups found in LDAP and automatically joins the user into them.
    Using it as an alternative login is not implemented as I couldn't figure it out quick enough. It should be easy to do - feel free to add a pull request.

    The source is on github. Pull requests are welcome!
    Please be kind, my JavaScript skills are limited.

  • 5 Votes
    5 Posts

    @psychobunny Pinging you since this is a fork of your plugin for paypal.

    Ok so, Update 1:
    Removed the function onload wrapper. Still same problem as above, however step closer, Now clicking the navigation once more loads the GET files. But doesnt do it on initial visit from navmenu.

    I guess a quick fix would be to just have it refresh or reload page when visiting it, but that isnt good i dont think.

    UPDATE 2: SOLVED.. Nevermind its not solved. Some times it works some times theres a delay and still never gets sent..

    Found another bug.. You may call me the bug hunter. 😄 line 90 - Getting an error i assume due to the template not entirely sure about this one.

    ajaxify.js in console brings up the following..

    So if you're subscribed, then go back to visit the Subscribe link in navmenu, the loading bar will continue to spin but not load or /redirect you. Unless you refresh.

  • 0 Votes
    14 Posts

    no, just I got an empty pull down menu when I clicked Topic Tools.

    Today I tried again, and got the pull down popolated.


  • 0 Votes
    7 Posts

    Gamification is a great boost for communities that aren't very active, even though it's forced. Many of the bbs communities I'm involved with rely on this.I will try to fix the point-ns, not now though.

  • 0 Votes
    3 Posts

    Thanks a lot. This should save me loads of time! 🙂