summaryrefslogtreecommitdiff
path: root/includes/external
diff options
context:
space:
mode:
Diffstat (limited to 'includes/external')
-rw-r--r--includes/external/pair/reference.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/includes/external/pair/reference.js b/includes/external/pair/reference.js
index 1d9fd46..16d1653 100644
--- a/includes/external/pair/reference.js
+++ b/includes/external/pair/reference.js
@@ -43,7 +43,18 @@ ws.on('message', (raw) => {
// server as the 'PEH2_SESSION_TOKEN' cookie when making an authenticated request.
console.log(`Token: ${data.token.substring(0, 10)}${"*".repeat(data.token.length - 10)}`);
// The token is stored in 'data.token', the code above censors all but the first 10 characters.
- process.exit();
+ // Once you have the token, you can make authenticated requests:
+ fetch("https://ponies.equestria.horse/api/session", {
+ // The 'session' endpoint returns information about the current session (name, IPs, dates, ...)
+ headers: {
+ Cookie: "PEH2_SESSION_TOKEN=" + data.token // Passing the token as a cookie
+ }
+ }).then((res) => {
+ res.json().then((data) => { // Most (if not all) endpoints return JSON data
+ console.log(data);
+ process.exit();
+ });
+ });
break;
case "reject":