Skip to content

Instantly share code, notes, and snippets.

@justingreerbbi
Created May 3, 2016 12:47
Show Gist options
  • Save justingreerbbi/8eb63d51e20d917111dc2205e2d48788 to your computer and use it in GitHub Desktop.
Save justingreerbbi/8eb63d51e20d917111dc2205e2d48788 to your computer and use it in GitHub Desktop.
nodeBB Config Example
var constants = Object.freeze({
type:'oauth2',
name:'wpoauthserver', // Something unique to your OAuth provider in lowercase, like “github”, or “nodebb”
oauth: {
requestTokenURL: '',
accessTokenURL: '',
userAuthorizationURL: '',
consumerKey:'',
consumerSecret: ''
},
oauth2: {
authorizationURL: '{yoursite.com}?oauth=authorize',
tokenURL:'{yoursite.com}?oauth=token',
clientID: {client_id},
clientSecret: '{client_secret}'
},
userRoute: '{yoursite.com}?oauth=me'
}),
——————–
OAuth.parseUserReturn = function(data, callback) {
// Alter this section to include whatever data is necessary
// NodeBB *requires* the following: id, displayName, emails.
// Everything else is optional.
// Find out what is available by uncommenting this line:
// console.log(data);
var profile = {};
profile.id = data.id;
profile.displayName = data.name;
profile.emails = [{ value: data.email }];
// Do you want to automatically make somebody an admin? This line might help you do that…
// profile.isAdmin = data.isAdmin ? true : false;
// Delete or comment out the next TWO (2) lines when you are ready to proceed
process.stdout.write(‘===\nAt this point, you\’ll need to customise the above section to id, displayName, and emails into the “profile” object.\n===’);
return callback(new Error(‘Congrats! So far so good — please see server log for details’));
callback(null, profile);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment