diff --git a/library.js b/library.js index 3a49576..ef86134 100644 --- a/library.js +++ b/library.js @@ -49,8 +49,9 @@ */ var constants = Object.freeze({ - type: '', // Either 'oauth' or 'oauth2' - name: '', // Something unique to your OAuth provider in lowercase, like "github", or "nodebb" + type: 'oauth2', // Either 'oauth' or 'oauth2' + name: 'icynet', // Something unique to your OAuth provider in lowercase, like "github", or "nodebb" + scope: 'email privilege', oauth: { requestTokenURL: '', accessTokenURL: '', @@ -59,12 +60,12 @@ consumerSecret: nconf.get('oauth:secret'), // don't change this line }, oauth2: { - authorizationURL: '', - tokenURL: '', - clientID: nconf.get('oauth:id'), // don't change this line - clientSecret: nconf.get('oauth:secret'), // don't change this line + authorizationURL: nconf.get('oauth:provider') + '/oauth2/authorize', + tokenURL: nconf.get('oauth:provider') + '/oauth2/token', + clientID: nconf.get('oauth:id'), + 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, OAuth = {}, passportOAuth, opts; @@ -171,15 +172,16 @@ var profile = {}; profile.id = data.id; - profile.displayName = data.name; + profile.displayName = data.display_name; 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... // 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')); + //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); }