Advertisement
Guest User

Untitled

a guest
Sep 12th, 2017
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. {"error":"invalid_grant","error_description":"authentication failure"}
  2.  
  3. local.http = new Http(url='https://test.salesforce.com/services/oauth2/token',method='post');
  4.  
  5. local.http.addParam(type='header',name='content-type', value='application/x-www-form-urlencoded');
  6. local.http.addParam(type='formField',name='grant_type', value='password');
  7. local.http.addParam(type='formField',name='client_id', value='client_id');
  8. local.http.addParam(type='formField',name='client_secret', value='client_password_string');
  9. local.http.addParam(type='formField',name='username', value='user@email.com');
  10. local.http.addParam(type='formField',name='password', value='userspassword');
  11. local.http.addParam(type='formField',name='format', value='json');
  12.  
  13. local.httpSendResult = local.http.send();
  14. rc.httpResult = httpSendResult.getPrefix();
  15.  
  16. <cfhttp url="https://test.salesforce.com/services/oauth2/token" method="POST">
  17. <cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded" />
  18. <cfhttpparam type="formField" name="grant_type" value="password" />
  19.  
  20. <cfhttpparam type="formField" name="client_id" value="client_id" />
  21. <cfhttpparam type="formField" name="client_secret" value="client_password_string" />
  22. <cfhttpparam type="formField" name="username" value="user@email.com" />
  23. <cfhttpparam type="formField" name="password" value="userspassword" />
  24.  
  25. </cfhttp>
  26. <cfset rc.result = cfhttp.fileContent />
  27.  
  28. curl -d "grant_type=password"
  29. -d "client_id=client_id"
  30. -d "client_secret=client_secret_string"
  31. -d "username=user@email.com.dev"
  32. -d "password=userpassword" https://test.salesforce.com/services/oauth2/token
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement