diff options
author | RaindropsSys <contact@minteck.org> | 2023-05-13 19:25:44 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-05-13 19:25:44 +0200 |
commit | 21ed7d0e837d74c1ebd8ada4396f96ce42c14fb1 (patch) | |
tree | 8bdad11e806ad4ac6c68902eaf72913a4554e484 /includes/external/pair | |
parent | f80190dddaa72d9f8863b0b922e557668b6cba27 (diff) | |
download | pluralconnect-21ed7d0e837d74c1ebd8ada4396f96ce42c14fb1.tar.gz pluralconnect-21ed7d0e837d74c1ebd8ada4396f96ce42c14fb1.tar.bz2 pluralconnect-21ed7d0e837d74c1ebd8ada4396f96ce42c14fb1.zip |
Updated 14 files and added 6 files (automated)
Diffstat (limited to 'includes/external/pair')
-rw-r--r-- | includes/external/pair/reference.js | 13 |
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": |