function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Artyom GrigorArtyom Grigor 

OAth 2 with jquery.

Hello,

I try to use a OAuth 2 in html with jquery in following way:

 

URL=https://login.salesforce.com/services/oauth2/token

 

/*$.ajax({
 type: "POST",
 url: "<URL>",
 data: "client_id="+escape(clientId)
+"&client_secret="+escape(client_secret)
+"&grant_type=password"
+"&username="+escape('artyomgrigor@gmail.com')
+"&password="+escape('<THE COMBINATION OF YOUR PASSWORD AND TOKEN>'),
 success: function(data, textStatus, jqXHR){
 alert( "Data Saved: " + textStatus );
 }
 });*/
In response I'll get nothing!!! Just 200 OK code.
Could you help me?

 

dkadordkador

Are you sure the HTTP response is empty?

SuperfellSuperfell

Seems like the browser sandbox wouldn't allow this request.

Artyom GrigorArtyom Grigor

Could you please explain extended? How can I deal with this sandbox problem?

whatisacommuinitynicknamewhatisacommuinitynickname

Hi!

 

What you should do is make the request in PHP, put the PHP script right next to your page there and then do everything through your AJAX page. Then you can use CURL or the PHP SDK to help you.

 

Hope this helps!

Cheers