Skip to content
This repository has been archived by the owner on Jun 2, 2021. It is now read-only.
/ mlh-api Public archive

πŸ§‘β€πŸ’» A wrapper for the Major League Hacking (MLH) API.

License

Notifications You must be signed in to change notification settings

TomerAberbach/mlh-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MLH API

NPM version

A wrapper for the Major League Hacking (MLH) API.

Install

Install with npm:

$ npm i mlh-api --save

Usage

Configuring the module:

const mlh = require('./index')

mlh.configure({
  clientId: 'YOUR_CLIENT_ID',
  clientSecret: 'YOUR_CLIENT_SECRET',
  redirectUri: 'YOUR_REDIRECT_URI'
})

Authorization Code Flow

Redirect your user to this url:

const url = mlh.authorizationCodeUrl(['your', 'scopes', 'here'])

Get the authorization code from the MLH callback to obtain an access token:

mlh.accessTokenFromAuthorizationCode(code).then(() => {
  // Module is now configured with the access token
  // Get user object
  return mlh.user()
}).then(user => {
  // Do stuff with user object
})

Implicit Authorization Flow

Redirect your user to this url:

const url = mlh.implicitAuthorizationUrl(['your', 'scopes', 'here'])

Set the access token from the MLH callback:

mlh.configure({ accessToken: token })

// Make user requests
mlh.users(1, 100).then(users => {
  // Do stuff with users
})

Please visit the module documentation and the MLH API documentation for more information

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Tomer Aberbach

License

MIT Β© Tomer Aberbach

About

πŸ§‘β€πŸ’» A wrapper for the Major League Hacking (MLH) API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published