@logiscool/passport-scoolcode
v1.0.3
Published
Passport startegy for Scoolcode OAuth
Downloads
9
Readme
Scoolcode OAuth Strategy
Usage
You can install the strategy using NPM or Yarn:
$ npm install @logiscool/passport-scoolcode
To use you have to initialise it:
const ScoolcodeStrategy = require('@logiscool/passport-scoolcode').Strategy;
passport.use(new ScoolcodeStrategy({
clientID: '...',
clientSecret: '...',
callbackURL: 'https://.../auth/sc/callback',
requestCRMToken: false
},
(accessToken, profile, callback) => {
console.log(accessToken.scoolcode); // Scoolcode token
console.log(accessToken.crm); // CRM token (if requested)
console.log(profile); // Scoolcode account
if(profile.kind.developer)
callback(null, profile)
else
callback(new Error('Forbidden: only for developers'))
}
));