· 2 years ago · Feb 27, 2023, 11:20 PM
1// Pastebin API - Login : https://pastebin.com/doc_api#9
2
3var api_dev_key = "YOUR API DEVELOPER KEY";
4var api_user_name = encodeURIComponent("a_users_username");
5var api_user_password = encodeURIComponent("a_users_password");
6
7var xhr = new XMLHttpRequest();
8xhr.withCredentials = true;
9
10xhr.addEventListener("readystatechange", function() {
11 if(this.readyState === 4) {
12 console.log(this.responseText);
13 }
14});
15
16xhr.open("POST", "https://pastebin.com/api/api_login.php");
17xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
18
19xhr.send(`api_dev_key=${api_dev_key}&api_user_name=${api_user_name}&api_user_password=${api_user_password}`);