Advertisement
Guest User

Untitled

a guest
May 31st, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. getToken();
  2.  
  3. function getToken()
  4. {
  5.  
  6. var options = {
  7. url: 'https://demo.docusign.net/restapi/v2/oauth2/token',
  8. method: 'POST',
  9. headers: {
  10. "Accept": "application/json",
  11. "Content-Type": "application/x-www-form-urlencoded",
  12. "Content-Length": 152,
  13. "grant_type=password&client_id=integrationid&username=email&password=password&scope=api"
  14. }
  15. };
  16.  
  17. // Send a http request to url and specify a callback that will be called upon its return.
  18. request(options, function (error, response, body)
  19. {
  20. var obj = JSON.parse(body);
  21. console.log( obj );
  22. for( var i = 0; i < obj.length; i++ )
  23. {
  24. var name = obj[i].name;
  25. console.log( name );
  26. }
  27. });
  28.  
  29. POST https://{server}/restapi/{apiVersion}/oauth2/token
  30. Accept: application/json
  31. Content-Type: application/x-www-form-urlencoded
  32. grant_type=password&client_id={IntegratorKey}&username={email}&password={password}&scope=api
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement