Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "connections": {
- "<my_username>": {
- "accessToken": "<my_accessToken>",
- "instanceUrl": "<https://my.partial.instance.com>",
- "client": "default"
- }
- },
- "clients": {
- "default": {
- "clientId": "<myclientid>",
- "clientSecret": "<longNumber>",
- "redirectUri": "https://localhost:1111",
- "loginUrl": "https://test.salesforce.com"
- }
- }
- }
- var jsforce = require('jsforce');
- var conn = new jsforce.Connection({
- oauth2 : {
- // you can change loginUrl to connect to sandbox or prerelease env.
- loginUrl : 'https://test.salesforce.com',
- clientId : '<myclientid>',
- clientSecret : '<longNumber>',
- redirectUri : '<https://my.partial.instance.com>'
- }
- });
- conn.login(username, 'password'+'<id>', function(err, userInfo) {
- if (err) { return console.error(err); }
- // Now you can get the access token and instance URL information.
- // Save them to establish connection next time.
- console.log(conn.accessToken);
- console.log(conn.instanceUrl);
- // logged in user property
- console.log("User ID: " + userInfo.id);
- console.log("Org ID: " + userInfo.organizationId);
- // ...
- });
Add Comment
Please, Sign In to add comment