Skip to content

Instantly share code, notes, and snippets.

@gdestuynder
Created May 2, 2019 17:04
Show Gist options
  • Save gdestuynder/0c8e4912d53b4517d1ab1f39a7965337 to your computer and use it in GitHub Desktop.
Save gdestuynder/0c8e4912d53b4517d1ab1f39a7965337 to your computer and use it in GitHub Desktop.
function(access_token, ctx, callback) {
request.get('https://bugzilla.allizom.org/api/user/profile', {
'headers': {
'Authorization': 'Bearer ' + access_token,
'User-Agent': 'Auth0'
}
}, function(e, r, b) {
if (e) {
return callback(e);
}
if (r.statusCode !== 200) {
return callback(new Error(`StatusCode: ${r.statusCode}`));
}
var profile = JSON.parse(b);
callback(null, {
user_id: profile.id,
bugzilla_nickname: profile.nick,
name: profile.name,
email: profile.login,
email_verified: true
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment