icynetify

This commit is contained in:
Evert Prants 2017-09-06 22:21:59 +03:00
parent 5e502244cc
commit a632baf6cb
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -49,8 +49,9 @@
*/ */
var constants = Object.freeze({ var constants = Object.freeze({
type: '', // Either 'oauth' or 'oauth2' type: 'oauth2', // Either 'oauth' or 'oauth2'
name: '', // Something unique to your OAuth provider in lowercase, like "github", or "nodebb" name: 'icynet', // Something unique to your OAuth provider in lowercase, like "github", or "nodebb"
scope: 'email privilege',
oauth: { oauth: {
requestTokenURL: '', requestTokenURL: '',
accessTokenURL: '', accessTokenURL: '',
@ -59,12 +60,12 @@
consumerSecret: nconf.get('oauth:secret'), // don't change this line consumerSecret: nconf.get('oauth:secret'), // don't change this line
}, },
oauth2: { oauth2: {
authorizationURL: '', authorizationURL: nconf.get('oauth:provider') + '/oauth2/authorize',
tokenURL: '', tokenURL: nconf.get('oauth:provider') + '/oauth2/token',
clientID: nconf.get('oauth:id'), // don't change this line clientID: nconf.get('oauth:id'),
clientSecret: nconf.get('oauth:secret'), // don't change this line clientSecret: nconf.get('oauth:secret'),
}, },
userRoute: '' // This is the address to your app's "user profile" API endpoint (expects JSON) userRoute: nconf.get('oauth:provider') + '/oauth2/user'
}), }),
configOk = false, configOk = false,
OAuth = {}, passportOAuth, opts; OAuth = {}, passportOAuth, opts;
@ -171,15 +172,16 @@
var profile = {}; var profile = {};
profile.id = data.id; profile.id = data.id;
profile.displayName = data.name; profile.displayName = data.display_name;
profile.emails = [{ value: data.email }]; profile.emails = [{ value: data.email }];
profile.isAdmin = data.privilege === 5;
// Do you want to automatically make somebody an admin? This line might help you do that... // Do you want to automatically make somebody an admin? This line might help you do that...
// profile.isAdmin = data.isAdmin ? true : false; // profile.isAdmin = data.isAdmin ? true : false;
// Delete or comment out the next TWO (2) lines when you are ready to proceed // 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==='); //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')); //return callback(new Error('Congrats! So far so good -- please see server log for details'));
callback(null, profile); callback(null, profile);
} }