• 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

Shared Authentication between two node apps when using mongodb

Scheduled Pinned Locked Moved General Discussion
11 Posts 5 Posters 5.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.
  • K Offline
    K Offline
    kevinprotoss
    wrote on last edited by
    #1

    Hello,

    I try to add my own site with a forum by using NodeBB. So far it's absolutely amazing as a forum software.
    However, it works as an independent node application. I had already a website by using nodejs which listens on the port 8080. Both my own website and the NodeBB forum have a login function. How could I shared authentication information between these two separate applications?

    Note: I use MongoDB.

    1 Reply Last reply
    0
  • K Offline
    K Offline
    kevinprotoss
    wrote on last edited by
    #2

    I'm not sure whether I found the answer.

    Is it possible to use connect-mongo for sharing the user session between two separate node app.
    e.g., www.mydomain.com
    forum.mydomain.com

    Can some one give me an answer?

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

    Yes, you can use connect-mongo (or connect-redis) to share sessions. You'll have to match your cookie information as well. Theoretically, this should work, although it may be easier to set up an oauth endpoint using oAuthorize instead.

    1 Reply Last reply
    0
  • K Offline
    K Offline
    kevinprotoss
    wrote on last edited by
    #4

    Thx so much.

    I will try that after a while

    1 Reply Last reply
    0
  • K Offline
    K Offline
    kevinprotoss
    wrote on last edited by kevinprotoss
    #5

    @julian said:

    Yes, you can use connect-mongo (or connect-redis) to share sessions. You'll have to match your cookie information as well. Theoretically, this should work, although it may be easier to set up an oauth endpoint using oAuthorize instead.

    I have a new question, how can I disable the local login strategy and use the new oauth endpoint? or did I understand wrong about the oauth2rize?

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

    If you have OAuth2orize set up on your other application, you can fork the sso oauth plugin, customise it, and point it to your new OAuth2 endpoint. To disable the local login, you'll have to remove the POST /login and /register routes, and change the theme header so that it just calls the OAuth SSO endpoint directly instead.

    1 Reply Last reply
    0
  • K Offline
    K Offline
    kevinprotoss
    wrote on last edited by
    #7

    @julian said:

    If you have OAuth2orize set up on your other application, you can fork the sso oauth plugin, customise it, and point it to your new OAuth2 endpoint. To disable the local login, you'll have to remove the POST /login and /register routes, and change the theme header so that it just calls the OAuth SSO endpoint directly instead.

    Super, that helps a lot!
    Thx in deed

    1 Reply Last reply
    0
  • M Offline
    M Offline
    miksago
    wrote on last edited by
    #8

    There's also a relevant Github issue open for disabling local logins: https://github.com/designcreateplay/NodeBB/issues/1263

    1 Reply Last reply
    1
  • kbladeK Offline
    kbladeK Offline
    kblade
    wrote on last edited by
    #9

    @kevinprotoss Have you been able to do the changes and make your website and nodebb sync with each other?

    1 Reply Last reply
    0
  • jareyJ Offline
    jareyJ Offline
    jarey Translator
    wrote on last edited by
    #10

    I'm interested in the same use case. Sharing a login form an app to an instance of nodebb. I'm particulary curious about how they achieved that on http://world.kano.me/ since it is an smooth and elegant result. Any clue on how they implemented it?

    julianJ 1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    replied to jarey on last edited by
    #11

    @José-Ángel-Rey-Liñares I don't believe Kano uses NodeBB anymore, though I could be mistaken.

    We still recommend https://github.com/julianlam/nodebb-plugin-sso-oauth, though if you have a login API that takes username/password, you could also consider writing a plugin that listens on the action:auth.overrideLogin hook...

    1 Reply Last reply
    0

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