Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var username = "myusername";
- var password = "password";
- var conn = new sf.Connection({
- oauth2: {
- clientId: 'clientID',
- clientSecret: 'SecretID',
- redirectUri: 'MyRedirectURl'
- },
- instanceUrl: 'InstanceUrl',
- accessToken: 'accestoken',
- //this refresh token i am generating for the first time from the POSTMAN
- refreshToken: 'my token'
- });
- conn.on("refresh", function (accessToken, res) {
- console.log('---res-refresh token');
- // Refresh event will be fired when renewed access token
- // to store it in your storage for next request
- });
- conn.login(username, password, function (err, userInfo) {
- if (err) {
- console.error(err);
- return callback(err);
- }
- // Now you can get the access token and instance URL information.
- // Save them to establish connection next time.
- authCreds.accessToken = conn.accessToken;
- authCreds.instanceUrl = conn.instanceUrl;
- // ...
- return callback();
- });
Add Comment
Please, Sign In to add comment