Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var json ={};
- json.client_id= "webshop_client";
- json.client_secret= "639a9118-b4ff-4617-86b2-50dcd20af961";
- json.grant_type="password";
- json.username="someusename";
- json.password ="somepassword";
- var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
- xhttp = new XMLHttpRequest();
- var url1="somrurl";
- xhttp.onreadystatechange = function () {
- console.log(xhttp.readyState+"||"+xhttp.status);
- if(xhttp.readyState == 4 && xhttp.status == 200){
- console.log(xhttp.responseText);
- service_response = JSON.parse(xhttp.responseText);
- accessToken = service_response.access_token;
- return callback(accessToken);
- }
- }
- xhttp.open("POST",url1,true);
- xhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
- xhttp.send(JSON.stringify(json));
- xhttp.withCredentials = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement