Integration with LinkedIn SSO oAuth2 - Users with commas



  • Hi everyone,
    I manage to integrate the LinkedIn SSO oAuth2 plugin with NodeBB, however, when a LinkedIn user has commas on this last name e.g. "John Smith, PMP, CSM" the plugin fails (see log below). I raised an issue on the plugin repository with no answer so far.
    Maybe you guys can give me some hints? I tried to replace the "," with "" but I get session errors. I think that the best way to solve it is to save the whole name with the commas in the DB, not quite sure how to do it since Mongo is my backend.

    Any hints?
    Thanks!
    Christian

    15/10 00:35:55 [10434] - error: /auth/linkedin/callback
    Error: [[error:invalid-username, John Smith, PMP, CSM]]
    at userNameValid (/root/nodebb/src/user/create.js:155:78)
    at /root/nodebb/node_modules/async/dist/async.js:3853:24
    at replenish (/root/nodebb/node_modules/async/dist/async.js:946:17)
    at iterateeCallback (/root/nodebb/node_modules/async/dist/async.js:931:17)
    at /root/nodebb/node_modules/async/dist/async.js:906:16
    at /root/nodebb/node_modules/async/dist/async.js:3858:13
    at emailValid (/root/nodebb/src/user/create.js:149:6)
    at /root/nodebb/node_modules/async/dist/async.js:3853:24
    at replenish (/root/nodebb/node_modules/async/dist/async.js:946:17)
    at /root/nodebb/node_modules/async/dist/async.js:950:9
    at eachOfLimit (/root/nodebb/node_modules/async/dist/async.js:975:24)
    at /root/nodebb/node_modules/async/dist/async.js:980:16
    at eachOf (/root/nodebb/node_modules/async/dist/async.js:1051:5)
    at _parallel (/root/nodebb/node_modules/async/dist/async.js:3852:5)
    at Object.parallelLimit [as parallel] (/root/nodebb/node_modules/async/dist/async.js:3935:5)
    at Object.User.isDataValid (/root/nodebb/src/user/create.js:146:9)
    at async.waterfall.userData.username (/root/nodebb/src/user/create.js:24:10)
    at nextTask (/root/nodebb/node_modules/async/dist/async.js:5297:14)
    at Object.waterfall (/root/nodebb/node_modules/async/dist/async.js:5307:5)
    at Object.User.create (/root/nodebb/src/user/create.js:22:9)
    at /root/nodebb/node_modules/nodebb-plugin-sso-linkedin-oauth2/library.js:126:12
    at /root/nodebb/src/database/mongo/sorted.js:248:4
    

  • Admin

    If you are handy with an editor, you can adding some logic above this line to clean the name of commas.



  • Thanks @julian for your answer, yes, I already tried:

    handle = handle.replace(",","");
    

    But all I can get is:
    0_1508448002540_Screen Shot 2017-10-19 at 5.15.08 PM.png

    I think that I have to save the whole name (including commas) in Mongo... does it make sense?

    Thanks!
    Christian


 

| |