{"_id":"@diekeure/passport-smartschool","_rev":"3-0e522fff8659abbc439c45bc6d947cf9","name":"@diekeure/passport-smartschool","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@diekeure/passport-smartschool","version":"0.1.0","description":"Smartschool authentication strategy for Passport.","keywords":["passport","smartschool","auth","authn","authentication","identity"],"author":{"name":"Bert Casier","email":"bert@ernie.be"},"repository":{"type":"git","url":"git://github.com/diekeure/passport-smartschool.git"},"bugs":{"url":"http://github.com/diekeure/passport-smartschool/issues"},"license":"MIT","licenses":[{"type":"MIT","url":"http://opensource.org/licenses/MIT"}],"main":"./lib/index.js","dependencies":{"passport-oauth2":"1.x.x"},"devDependencies":{"chai":"^4.1.2","chai-passport-strategy":"^1.0.0","make-node":"0.3.x","mocha":"^5.0.1"},"engines":{"node":">= 4.0.0"},"scripts":{"test":"mocha --require test/bootstrap/node test/*.test.js"},"private":false,"gitHead":"db04b31a46ebfc0db1f2b4305e86dba2214b0042","homepage":"https://github.com/diekeure/passport-smartschool#readme","_id":"@diekeure/passport-smartschool@0.1.0","_npmVersion":"5.6.0","_nodeVersion":"6.9.4","_npmUser":{"name":"diekeure-npm","email":"bert.casier@diekeure.be"},"dist":{"integrity":"sha512-WonEPc0UGT453PLSxmCnRfTHibejaERnNfxJnlASUkxtSA0T4ssbI9Gsq6x/BZc3CrTwlxYYzIrZK0wvXxF3hA==","shasum":"064b077c75c0969b1914d4b490f1af0cdbdbebca","tarball":"https://registry.npmjs.org/@diekeure/passport-smartschool/-/passport-smartschool-0.1.0.tgz","fileCount":5,"unpackedSize":9478,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC/wiFk3QlTXLgh+y38e6L/vVeiaFXEVvq3WcV1k8OieAiEA7D3kabijmEBp3rOIh1snYXMKwDB6eOPOrcOM78F7d2A="}]},"maintainers":[{"name":"diekeure-npm","email":"bert.casier@diekeure.be"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/passport-smartschool_0.1.0_1519216653587_0.6364227092410961"},"_hasShrinkwrap":false}},"time":{"created":"2018-02-21T12:37:33.516Z","0.1.0":"2018-02-21T12:37:33.645Z","modified":"2022-04-05T04:25:24.968Z"},"maintainers":[],"description":"Smartschool authentication strategy for Passport.","homepage":"https://github.com/diekeure/passport-smartschool#readme","keywords":["passport","smartschool","auth","authn","authentication","identity"],"repository":{"type":"git","url":"git://github.com/diekeure/passport-smartschool.git"},"author":{"name":"Bert Casier","email":"bert@ernie.be"},"bugs":{"url":"http://github.com/diekeure/passport-smartschool/issues"},"license":"MIT","readme":"# passport-smartschool\n\n[![Build](https://img.shields.io/travis/diekeure/passport-smartschool.svg)](https://travis-ci.org/diekeure/passport-smartschool)\n[![Coverage](https://img.shields.io/coveralls/diekeure/passport-smartschool.svg)](https://coveralls.io/r/diekeure/passport-smartschool)\n[![Quality](https://img.shields.io/codeclimate/github/diekeure/passport-smartschool.svg?label=quality)](https://codeclimate.com/github/diekeure/passport-smartschool)\n[![Dependencies](https://img.shields.io/david/diekeure/passport-smartschool.svg)](https://david-dm.org/diekeure/passport-smartschool)\n\n\n[Passport](http://passportjs.org/) strategy for authenticating with [Smartschool](http://www.smartschool.be/)\nusing the OAuth 2.0 API.\n\nThis module lets you authenticate using Smartschool in your Node.js applications.\nBy plugging into Passport, Smartschool authentication can be easily and\nunobtrusively integrated into any application or framework that supports\n[Connect](http://www.senchalabs.org/connect/)-style middleware, including\n[Express](http://expressjs.com/).\n\n## Install\n\n    $ npm install diekeure/passport-smartschool\n\n## Usage\n\n#### Create an Application\n\nBefore using `passport-smartschool`, you must register your application with\nSmartschool, through [this form](http://www.smartschool.be/oauth/).\nSmartschool will issue an app ID and app secret, which need to be provided to the strategy.\nYou will also need to configure a redirect URI which matches the route in your\napplication.\n\n#### Configure Strategy\n\nThe Smartschool authentication strategy authenticates users using a Smartschool\naccount and OAuth 2.0 tokens.  The app ID and secret obtained when creating an\napplication are supplied as options when creating the strategy.  The strategy\nalso requires a `verify` callback, which receives the access token and optional\nrefresh token, as well as `profile` which contains the authenticated user's\nSmartschool profile.  The `verify` callback must call `cb` providing a user to\ncomplete authentication.\n\n```js\npassport.use(new SmartschoolStrategy({\n    clientID: SMARTSCHOOL_APP_ID,\n    clientSecret: SMARTSCHOOL_APP_SECRET,\n    callbackURL: \"http://localhost:3000/auth/smartschool/callback\"\n  },\n  function(accessToken, refreshToken, profile, cb) {\n    User.findOrCreate({ smartschoolId: profile.id }, function (err, user) {\n      return cb(err, user);\n    });\n  }\n));\n```\n\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'smartschool'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n```js\napp.get('/auth/smartschool',\n  passport.authenticate('smartschool'));\n\napp.get('/auth/smartschool/callback',\n  passport.authenticate('smartschool', { failureRedirect: '/login' }),\n  function(req, res) {\n    // Successful authentication, redirect home.\n    res.redirect('/');\n  });\n```\n\n## Contributing\n\n#### Tests\n\nThe test suite is located in the `test/` directory.  All new features are\nexpected to have corresponding test cases.  Ensure that the complete test suite\npasses by executing:\n\n```bash\n$ make test\n```\n\n#### Coverage\n\nThe test suite covers 100% of the code base.  All new feature development is\nexpected to maintain that level.  Coverage reports can be viewed by executing:\n\n```bash\n$ make test-cov\n$ make view-cov\n```\n\n## Credits\n\nThis package was copied from [passport-facebook](https://github.com/jaredhanson/passport-facebook) by Jared Hanson, and adapted to the needs of smartschool\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2016 Diekeure NV <[http://www.diekeure.be/](http://www.diekeure.be/)>\n","readmeFilename":"README.md"}