[nodebb-plugin-session-sharing] Session Sharing
-
-
This sounds perfect -- for our game (forum at http://forum.traverse.world/) I'd love to authenticate on forum, and share session with the game.
Can I use this plugin to share session in that direction? (from nodeBB to app)
-
v1.0.13 released
- [Bug] Fixed issue where if a user was created by the session sharing plugin and subsequently deleted (in the ACP), a new login through session-sharing would result in an endless loop as the user reference was missing. A new user is now created.
-
@julian This plugin looks great. I'm linking to the forum from within a mobile app, so it will be perfect for user experience.
I'm having a couple of issues getting it to work though:
-
From the Session Sharing admin page on user search I keep getting 'We were unable to find a remote id belonging to that user'. I assumed this was just the uid? I don't get any results for remote ID search using uids.
-
Running NodeBB in dev mode, I can call the '/debug/session/' endpoint and get a 200 OK response. A document in the sessions collection is created with session value
{"cookie":{"originalMaxAge":1209600000,"expires":"2016-05-25T14:36:09.230Z","httpOnly":true,"path":"/"}}'
but no testUser is created. -
I've tried creating a cookie to test in the browser with 'javascript:document.cookie="token=<JWT token>" 'but it doesn't seem to be picked up by the page
I do have the authentication overridden (hook "action:auth.overrideLogin") with my own system, so I'm hoping that isn't related to this, or likely to cause issues down the line.
I'm currently running v1.0.2, if that helps.
-
-
I keep getting 'We were unable to find a remote id belonging to that user'. I assumed this was just the uid? I don't get any results for remote ID search using uids.
That search would be for putting in a NodeBB ID and finding the "remote id" associated with it. e.g. uid 1 on NodeBB is linked to session share id of
2b54c8d65eaff
, so you can search for1
and get that ID back./debug/session
gives you the cookie, but won't create the user until you access the site itself.The cookie set via javascript may not be read because the session sharing cookie is http only. That may be why...
-
Hey @julian , thanks for this useful plugin.
Why is username or first and last name required in addition to ID inside the JWT? Is it possible to remove this requirement and only require ID to be contained in the JWT?
Surely the user's account can be located with just the ID, correct?
-
When I remove the requirement for username or full name, the findUser does not find the user, the async.parallel returns:
{ uid: null, mergeUid: null }
https://github.com/julianlam/nodebb-plugin-session-sharing/blob/master/library.js
and line 185, the last else clause, would be executedI suspect it has to do with lines 159 and 160, but I do not understand the code here, do you have any ideas?
-
I dont know how is this auth process works with jwt.
I have nodebb inforum.example.com
and nodejs app inexample.com
. And reverse proxy with nginx. I have few question:-When user logins or signs up which route we should POST method to?
-Do I need to installnpm install jsonwebtoken
?
-Is this JWT Secret key obtained from jwt.io website?
-How can I save a cookie to user browser?
-When I achieve all this and users logins with nodebb credentials how can i access to current logged in user info?
-Do I need to include the user's passwords to Json web token?
-Do I need to set secret in nodebb admin panel?Edit:So I did some googling and what I understand I need to post the user info to some expressjs route on my app and generate the Json web token in backend and use some cookie plugin for nodejs. But my last two question is remain unclear for me.
@julian -
-
first sorry for my english it is not my first language
i am using the session sharing plugin and it is working wonderful , the users on my app login directly to the nodeBB, but i need to classify them into groups I created two group already from the admin panel (Group-1 , Group-2) as i under stand i need to setup the settings from the admin panel and put the group title at the JWT payload that i send to be saved at the cookies
here is how my payload looks like id: uuid,
email: [email protected],
username: username,
groupTitle: 'Group-1',but when i check the user on nodebb i notes that the user created and logged in successfully but the user join no group ... is it the right approach ??? what to do??
@julian -
Hi,
This is a wonderful plugin and it has worked fine for our users. Unfortunately for some users, we set unsigned tokens (cookies). They were complaining about not being able to log in. As soon as we recognized the problem, we changed their cookies to signed ones. Now they are not getting the error message about the need to sign the JWT token but nodebb is not logging them in. They have the cookie set with the correct - signed JWT token - but they are not logged in.
Any clues on how to solve this?
-
hi, @julian
I encountered a problem while using this plugin. When registered users jump to the forum, they will register a new user. Even if "id" is the id of an old user, a new user will be registered. -
@cifangyiquan if the user has an existing account before attempting session share login then they will get a new account, since the "remote id" passed in is unknown.
I believe if you pass in an email, it should attempt email user matching.