SSO Authentication - Https - NGINX configuration

Technical Support
  • Hi folks,

    I am currently struggling on using sso plugins with my nodebb instance (online).
    I have done quite some researches here and from the web, but did not get any answer.
    Still, I saw several topics about the subject.
    Thanks for having a look, and hope it could help others too.

    I handle SSL using a nginx reverse-proxy behind all my nodes applications and here are the errors found :
    SSO-Google
    Oops! Looks like something went wrong!
    /auth/google/callback
    Bad Request

    SSO-GIT
    Oops! Looks like something went wrong!
    /auth/github/callback
    The redirect_uri MUST match the registered callback URL for this application.

    ... and same kind of error for FB.

    Concerning the App configuration it seems well configured with an Https callback URL:
    https://-.-.io/auth/github/callback
    https://-.-.io as homepage.

    My NGINX configuration try to pass all needed information within the header :
    "
    proxy_pass http://localhost:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Forwarded-Port 443;
    "

    And finally the traces I think the problem comes from, the (it's not the case for this nodeBB forum)

    Github 302 (OK) :
    (mine)
    GET /auth/github HTTP/1.1
    Host: community.-.io

    (nodebb)
    GET /auth/github HTTP/1.1
    Host: community.nodebb.org

    Authorize (PROBLEM) :
    (mine)
    GET /login/oauth/authorize?response_type=code&redirect_uri=http%3A%2F%2Fcommunity.-.io%2Fauth%2Fgithub%2Fcallback&s...
    HTTP/1.1
    Host: github.com

    (nodeBB)
    GET /login/oauth/authorize?response_type=code&redirect_uri=https%3A%2F%2Fcommunity.nodebb.org%2Fauth%2Fgithub%2Fcallback&... HTTP/1.1
    Host: github.com

    Why am I loosing the S from the protocol ?!

    Thank you for your help.
    Kind regards.
    Hybesis

  • Finally found a topic with good explanation an answers:

    Didn't expect the config.json would influence such requests.

    Kind regards.


Suggested Topics


  • 0 Votes
    1 Posts
    212 Views

    Hello,

    In order to connect to the MongoDB of my VPS by means of MongoDB Community Compass installed on my PC, I need to provide authentication: username, password and authentication database. Which credentials may I set here? The username admin and the authentication database admin, or the username nodebb and the authentication database nodebb? Also, what must I do with the connection configuration options "SRV Record", "Read Preference" and "SSL"? May I set something here?

    Regards,
    Néstor Llamas Llopis

  • 0 Votes
    2 Posts
    166 Views

    Nevermind, figured it out.
    Inside of config.json there is the url field and a port field... I had a port inside of the URL field, and I removed the port from the url and restarted nodebb, and it's working now!

  • 0 Votes
    9 Posts
    2k Views

    @julian said in Anyone here able to help with an NGINX config issue?:

    @Joykiller We're on a pretty old version of Ghost actually 😞

    0.7.1 😬

    Yeah thats what I thought.

  • 0 Votes
    1 Posts
    584 Views

    I'm trying to do some Oauth2 integration, and I need to know what a few of these variables are expecting in this part of the code:

    oauth2: { authorizationURL: 'https://mywebsite.com/oauth/authorize', <-- Does that look right? tokenURL: '[WHAT GOES HERE?]', clientID: 'CLIENT-ID', clientSecret: 'THE-SECRET' }, // what might userRoute look like?! userRoute: '' // This is the address to your app's "user profile" API endpoint (expects JSON)

    Thank you!

  • 0 Votes
    18 Posts
    5k Views

    Now ive managed to get this error:

    11/11 04:38 [17046] - error: TypeError: Cannot call method 'trim' of undefined
    at Object.User.create (/var/www/html/forum/nodebb/src/user/create.js:17:33)
    at /var/www/html/forum/nodebb/node_modules/nodebb-plugin-sso-facebook/library.js:160:12
    at try_callback (/var/www/html/forum/nodebb/node_modules/redis/index.js:573:9)
    at RedisClient.return_reply (/var/www/html/forum/nodebb/node_modules/redis/index.js:661:13)
    at ReplyParser.<anonymous> (/var/www/html/forum/nodebb/node_modules/redis/index.js:309:14)
    at ReplyParser.emit (events.js:95:17)
    at ReplyParser.send_reply (/var/www/html/forum/nodebb/node_modules/redis/lib/parser/javascript.js:300:10)
    at ReplyParser.execute (/var/www/html/forum/nodebb/node_modules/redis/lib/parser/javascript.js:203:22)
    at RedisClient.on_data (/var/www/html/forum/nodebb/node_modules/redis/index.js:534:27)
    at Socket.<anonymous> (/var/www/html/forum/nodebb/node_modules/redis/index.js:91:14)
    [cluster] Child Process (17046) has exited (code: 1, signal: null)
    [cluster] Spinning up another process...
    11/11 04:38 [17061] - info: Time: Wed Nov 11 2015 04:38:27 GMT-0500 (EST)
    11/11 04:38 [17061] - info: Initializing NodeBB v0.9.0

    11/11 04:38 [17061] - warn: [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run ./nodebb reset -p PLUGINNAME to disable it.

    nodebb-plugin-composer-default nodebb-plugin-markdown nodebb-plugin-mentions nodebb-widget-essentials nodebb-rewards-essentials nodebb-plugin-soundpack-default nodebb-plugin-spam-be-gone nodebb-plugin-gravatar-extended nodebb-plugin-sso-facebook nodebb-plugin-youtube-lite nodebb-theme-persona

    11/11 04:38 [17061] - info: [plugins/spam-be-gone] Settings loaded
    11/11 04:38 [17061] - info: NodeBB Ready
    11/11 04:38 [17061] - info: NodeBB is now listening on