• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Programatically create users

Scheduled Pinned Locked Moved NodeBB Development
7 Posts 3 Posters 3.4k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    biz
    wrote on last edited by
    #1

    Hello.

    I have a web application with a local login and registration system using email and password.

    I want to programatically create a forum account upon registering for the web application, using the same email and password.

    Is there a way to do this yet or no? I don't mind writing a plugin, but I want to make sure there is no existing way to do this.

    1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by yariplus
    #2

    There are multiple ways depending on your needs. You probably want nodebb-plugin-session-sharing. This plugin reads a cookie from your app, and when a user logged into your app visits the forum, will create their account and log them in. It can also redirect guests to your apps page, and sign users out when they log out of your app.

    B 2 Replies Last reply
    0
  • B Offline
    B Offline
    biz
    replied to yariplus on last edited by
    #3

    @yariplus Thanks I will check it out.

    1 Reply Last reply
    0
  • B Offline
    B Offline
    biz
    replied to yariplus on last edited by
    #4

    @yariplus Do you know of a way to just create the users one time? I see the createUser function in nodebb and I'll probably write a plugin to use that, unless you know of someone who has done this already.

    yariplusY 1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    replied to biz on last edited by yariplus
    #5

    @biz That's probably the best way. Any one of the import plugins should have all the methods you need in it already, and you can just add the accounts manually or read from your db etc.

    1 Reply Last reply
    0
  • julianJ Online
    julianJ Online
    julian GNU/Linux
    wrote on last edited by
    #6

    @biz @yariplus Either write a custom plugin to hook into the createUser method (actually, it's User.create...), or use nodebb-plugin-write-api and make a POST to /api/v1/users to create a new user.

    The latter is likely easier to do 😄

    B 1 Reply Last reply
    0
  • B Offline
    B Offline
    biz
    replied to julian on last edited by
    #7

    @julian Oh definitely, will do. Thanks.

    1 Reply Last reply
    0
  • E eeeee referenced this topic on

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development