@logiscool/passport-scoolcode
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @logiscool/passport-scoolcode

Weekly Downloads

5

Version

1.0.3

License

UNLICENSED

Unpacked Size

18.6 kB

Total Files

10

Last publish

Collaborators

  • ajuhos
  • lsc-deploy
  • mfulop