adp
Version:
Toolkit for interfacing with ADP Marketplace API's
64 lines (48 loc) • 1.78 kB
JavaScript
var fs = require('fs');
module.exports = {
// This is the path to your .key certificate file.
cert_key_path : './certs/api.key',
// This is the path to your .pem certificate file.
cert_pem_path : './certs/api.pem',
// End point for obtaining Bearer Token.
s_bearer_token_endpoint : 'https://apidit.nj.adp.com/auth/oauth/v2/token',
// Your ADP Client ID.
s_client_id : '459733c0-980f-4951-879e-23aa9fe0509f',
// Your ADP Client Secret.
s_client_secret : 'e28ec854-4d55-4778-8901-f4e10f87ecd4',
// Your configured Client Application Callback URI.
s_callback_redirect_uri : 'http://localhost:8888/callback',
// End point for obtaining Access Token.
s_token_endpoint : 'https://apidit.nj.adp.com/auth/oauth/v2/authorize',
// End point for user info API.
s_user_endPoint : 'https://apidit.nj.adp.com/core/v1/userinfo',
// Token response type.
s_response_type : 'code',
// Grant type for Bearer Token API call.
s_grant_type : 'client_credentials',
// Authentication scope.
s_scope : 'openid',
// Athentication state.
s_state : Math.random(),
// Full token authentication URI.
s_full_token_endpoint : function() {
return encodeURI(
this.s_token_endpoint +
'?client_id=' + this.s_client_id +
'&response_type=' + this.s_response_type +
'&redirect_uri=' + this.s_callback_redirect_uri +
'&scope=' + this.s_scope +
'&state=' + this.s_state);
},
// Agent options needed to perform Bearer token API call.
// This function does a full read of your certificate
// files using fs.readFileSync().
agent_options: function(){
return {
ca: [fs.readFileSync(this.cert_pem_path)],
key: fs.readFileSync(this.cert_key_path),
cert: fs.readFileSync(this.cert_pem_path),
securityOptions: 'SSL_OP_NO_SSLv3'
};
}
};