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