1.0.7 • Published 4 years ago

passport-osu-web v1.0.7

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

passport-osu

A simple Strategy for Passport authentication with osu! V2. TypeScript Definitions are Included for Code-Completion.

import {OsuStrategy, OsuStrategyOptions} from 'passport-osu'
passport.use(new OsuStrategy(new OsuStrategyOptions({
    clientID: "--ID--",
    clientSecret: "--SECRET--",
    callbackURL: "http://localhost:3000/auth/osu/callback"
  }),
  function(accessToken, refreshToken, profile, done) {
    // placeholder for translating profile into your own custom user object.
    // for now we will just use the profile object returned by GitHub
    return done(null, profile);
  }
));

// we will call this to start the GitHub Login process
app.get('/auth/osu', passport.authenticate('osu'));

// Osu will call this URL
app.get('/auth/osu/callback',
  passport.authenticate('osu', { failureRedirect: '/' }),
  function(req, res) {
    res.redirect('/');
  });