1.2.0 • Published 4 years ago

bitrix24oauth v1.2.0

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

bitrix24OAuth

OAuth2 authorization on bitrix24

USAGE

const bxOAuth = require('bitrix24oauth');
bxOAuth.authorize(
    "https://examplle.com",
    "local.00000000000.00000000",
    "122323232321213213213123232"
).then(login => {
    //return login("login", "pass", 679000)
    return login("login", "pass")
}).then(data => {
    console.log(data);
}).catch(err => {
    console.error(err);
});

Methods

authorize(url, clientId, state)

Prepares a form for sending data. This function returns a closure. The closing function authorizes by login and password

  • url - Bitrix24 portal address. Required.
  • clientId - Application code received in the affiliate account when registering the application (and valid for any Bitrix24), or obtained in a specific Bitrix24 in case of a local application (it will be valid only for this Bitrix24). Required.
  • state - An additional parameter that allows the application to transfer arbitrary additional data between the authorization steps. Required.

authorize.login()

The closure that the "authorize" function returned. Authorizes on the portal and receives a token

  • login - Bitrix24 portal login. Required
  • pass - Bitrix24 portal password. Required
  • otp - OTP password from Bitrix24 portal, if used. Optional

Results

{
    "access_token": "12345",  
    "client_endpoint": "https://example.com/rest/",  
    "domain": "oauth.bitrix.info",  
    "expires_in": 3600,  
    "member_id": "123456",  
    "refresh_token": "1234567",  
    "scope": "app",  
    "server_endpoint": "https://oauth.bitrix.info/rest/",  
    "status": "T"
}