@logiscool/passport-scoolcode

Passport startegy for Scoolcode OAuth

Usage no npm install needed!

<script type="module">
  import logiscoolPassportScoolcode from 'https://cdn.skypack.dev/@logiscool/passport-scoolcode';
</script>

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'))
    }
));