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
Javascriptvar 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
Sample code
Set password authentication
Javascriptvar 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
Set APIToken authentication
Javascriptvar 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
Sample code
Set basic authentication
Javascriptvar 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
Sample code
Set client certificate by binary data
Nodejsconst 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
Sample code
Set client certificate by path
Nodejsconst params = { filePath: 'YOUR_CERT_PATH_FILE', password: 'YOUR_CERT_FILE_PASSWORD' }; //set client cert by file path and password kintoneAuth.setClientCertByPath(params);