Able to see " Register ", " Login "

Technical Support

Suggested Topics


  • 0 Votes
    1 Posts
    227 Views

    Hi all,

    still continuing on my OAuth2 plugin implementation, I've a problem I can't actually solve and need you valuable advises.

    I've this fragment in my plugin

    OAuth.getStrategy = function (strategies, callback) { winston.verbose('[maxonID] --> OAuth.getStrategy'); if (configOk) { passportOAuth = require('passport-oauth2'); passportOAuth.Strategy.prototype.userProfile = function (accessToken, done) { if (!accessToken) { done(new Error('Missing token, cannot call the userinfo endpoint without it.')); } this._oauth2.useAuthorizationHeaderforGET(true); this._oauth2.get(constants.userRoute, accessToken, function (err, body, res) { if (err) { console.error(err); return done(new Error('Failed to get user info. Exception was previously logged.')); } if (res.statusCode < 200 || res.statusCode > 299) { return done(new Error('Unexpected response from userInfo. [' + res.statusCode + '] [' + body + ']')); } OAuth.validateEntitlement(accessToken, constants.allowedEntitlement, function (err, accessAllowed) { if (err) { return done(err); } if (!accessAllowed) { // Need to find a way to gracefully notify the user and point back to login page return done(new Error('Forum access is not granted. Please contact your representative.')); } try { var json = JSON.parse(body); OAuth.parseUserReturn(json, function (err, profile) { ...

    and I'd like to return the user to the forum login page and notify him about the issue, something like when the password is wrong. Is there a smart way to make it happen from such a plugin without rising an error?

    Thanks a lot for your valuable insights, R.

  • 0 Votes
    5 Posts
    1k Views

    Been offline for a bit but it looks like this has been addressed. This has been fixed by @julian in commit d33d965 to nodebb-theme-persona and commit 9d202d9 to nodebb.

    Thanks Julian!

  • 0 Votes
    4 Posts
    1k Views

    Right now I don't believe this functionality exists for the plugin. However you can definitely post a reply to that issue to show your interest in it 😄 Then when the issue gets closed you will be notified.

  • 0 Votes
    2 Posts
    1k Views

    Ok, when I switched to using a clustered setup with nginx serving static assets this issue went away.

  • 0 Votes
    3 Posts
    2k Views

    @baris thank you for your help 😆 . nodebb is a very excited project