passport-sbhs
Passport strategy for SBHS' OAuth2 implementation.
Installation
npm install passport-sbhs
Usage
Use this strategy just like you would use the standard OAuth2 strategy. The only difference is that this adds some convenience functions and the profile variable in the verification callback actually works.
To access protected JSON data, you can call getJSONResource
with the endpoint URL, or you could use some of the methods below to save a few lines of code. All they do is request the JSON you want, and parse it with JSON.parse
.
userProfile(accessToken, callback); // User Information
awardScheme(accessToken, callback); // Award Scheme Participation
timetable(accessToken, callback); // Timetable
day(accessToken, callback, date); // Day Timetable and Various Details
dailyNotices(accessToken, callback, date); // Daily Notices
The date parameters are optional. The format is YYYY-MM-DD.
Important Information
The strategy is the module itself. It isn't require('passport-sbhs').Strategy
.
Visit the SBHS API documentation to find out what these functions do in more detail.