Skip to content

Authentication

  • Authentication module will be used by Connection.
  • This module allows authenticating with the Kintone app by:
    • Password Authentication
    • API token authentication
    • Basic authenticator

Warning

  • If both the Token and Password Authentication are specified, the Token Authentication will be ignored and the Password authentication will be used.

Constructor

Parameters

(none)

Sample code

Init authentication module Javascript

    var kintoneAuth = new kintoneJSSDK.Auth();

Nodejs

    const kintone = require('@kintone/kintone-js-sdk');
    let kintoneAuth = new kintone.Auth();

Methods

setPasswordAuth(params)

Set password authentication for Authentication module.

Parameters

Name Type Required Description
params Object yes The parameters that include username, password properties
params.username String yes The username that is able to authenticate on kintone app
params.password String yes The password that is able to authenticate on kintone app

Return

Auth

Sample code

Set password authentication Javascript
    var basicAuth = {
        username: 'YOUR_USER_NAME',
        password: 'YOUR_PASSWORD'
    };
    kintoneAuth.setPasswordAuth(basicAuth);

Nodejs
    const basicAuth = {
        username: 'YOUR_USER_NAME',
        password: 'YOUR_PASSWORD'
    };
    kintoneAuth.setPasswordAuth(basicAuth);

setApiToken(params)

Set Api Token for Authentication module.

Parameters

Name Type Required Description
params Object yes The parameters that includes apiToken property
params.apiToken String yes The apiToken that is able to authenticate on kintone app

Return

Auth

Set APIToken authentication Javascript
    var params = {
        apiToken: 'YOUR_TOKEN'
    };
    kintoneAuth.setApiToken(params);

Nodejs
    const params = {
        apiToken: 'YOUR_TOKEN'
    };
    kintoneAuth.setApiToken(params);

setBasicAuth(params)

Set Basic authentication for Authentication module.

Parameters

Name Type Required Description
params Object yes The parameters that includes username, password properties
params.username String yes The username that is able to authenticate on kintone app
params.password String yes The password that is able to authenticate on kintone app

Return

Auth

Sample code

Set basic authentication Javascript
    var basicAuth = {
        username: 'YOUR_USER_NAME',
        password: 'YOUR_PASSWORD'
    };
    kintoneAuth.setBasicAuth(basicAuth);

Nodejs
    const basicAuth = {
        username: 'YOUR_USER_NAME',
        password: 'YOUR_PASSWORD'
    };
    kintoneAuth.setBasicAuth(basicAuth);

setClientCert(params)

Setting Authentication with the client certificate & password set.

Parameters

Name Type Required Description
params Object yes The parameters that includes cert, password properties
params.cert BinaryData yes Binary data of client certificate
params.password String yes Password of client certificate

Return

Auth

Sample code

Set client certificate by binary data Nodejs
    const filePath = 'YOUR_CERT_PATH_FILE';
    const params = {
        cert: fs.readFileSync(filePath),
        password: 'YOUR_CERT_FILE_PASSWORD'
    };
    //set client cert by file content and password
    kintoneAuth.setClientCert(params);

setClientCertByPath(params)

Setting Authentication with the client certificate & password set by file path

Parameters

Name Type Required Description
params Object yes The parameters that includes filePath, password properties
params.filePath String yes File path to client certificate
params.password String yes Password of client certificate

Return

Auth

Sample code

Set client certificate by path Nodejs
    const params = {
        filePath: 'YOUR_CERT_PATH_FILE',
        password: 'YOUR_CERT_FILE_PASSWORD'
    };
    //set client cert by file path and password
    kintoneAuth.setClientCertByPath(params);