MusicBrainz OAuth 2 authentication strategy for Passport.js.
This module allows for authentication with MusicBrainz from within a Node.js application. It was built for use in BookBrainz.
$ npm install passport-musicbrainz-oauth2
Usage is very similar to passport-oauth2, which this library wraps. The
required parameters are clientID
, clientSecret
, callbackURL
and scope
—
see here for more
information. A typical use case looks like this:
const MusicBrainzOAuth2Strategy = require('passport-musicbrainz-oauth2');
passport.use(new MusicBrainzOAuth2Strategy(
{
clientID: MUSICBRAINZ_CLIENT_ID,
clientSecret: MUSICBRAINZ_CLIENT_SECRET,
callbackURL: 'https://www.example.com/auth/musicbrainz-oauth2/callback',
scope: 'profile'
},
function(accessToken, refreshToken, profile, done) {
// Fetch user here
}
));