Skip to content

Latest commit

 

History

History
45 lines (39 loc) · 1.04 KB

README.md

File metadata and controls

45 lines (39 loc) · 1.04 KB

OAuth2

Promise based OAuth 2.0 library.

Functions

  • formAuthorzationUri
    • Returns a Promise that resolves to a complete authorization URL that you can redirect to.
    • Accepts an object in the following format:
{
    client: {
        id: 'SOME-CLIENT-ID',
        secret: 'SOME-SECRET'
    },
    uri: {
        authorization: 'https://someoauth.com/auth',
        token: 'https://someoauth.com/token'
        redirect: 'https://mywonderfulapp.com'
    },
    scope: 'SOME SCOPE HERE',
    responseType: 'RESPONSE-TYPE-IF-ANY'
}
  • getAccessToken
    • Returns a Promise that resolves to an object containing the response from the token request.
    • Accepts an object in the following format:
{
    client: {
        id: 'SOME-CLIENT-ID',
        secret: 'SOME-SECRET'
    },
    uri: {
        authorization: 'https://someoauth.com/auth',
        token: 'https://someoauth.com/token'
        redirect: 'https://mywonderfulapp.com'
    },
    scope: 'SOME SCOPE HERE',
    code: 'AUTHORIZATION-CODE'
}