Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

v2.8.0 #57

Merged
merged 4 commits into from
Apr 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,5 @@ fortniteAPI.login()
```js
true
```

- killSession() : `Promise` with no Return | Kill Session
22 changes: 21 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FortniteApi {
let expireDate = new Date(
new Date(this.expires_at).getTime() - 15 * 60000
);
if (this.expires_at && expireDate < actualDate) {
if (this.access_token && this.expires_at && expireDate < actualDate) {
this.expires_at = undefined;
//Refresh Token
request({
Expand Down Expand Up @@ -460,6 +460,26 @@ class FortniteApi {
});
});
}

killSession() {
return new Promise((resolve, reject) => {
request({
url: EndPoint.killSession(this.access_token),
headers: {
Authorization: "bearer " + this.access_token
},
method: "DELETE",
json: true,
body: {}
})
.then(() => {
resolve();
})
.catch(() => {
reject();
});
});
}
}

module.exports = FortniteApi;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fortnite-api",
"version": "2.7.2",
"version": "2.8.0",
"description": "Fortnite API",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions tools/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ module.exports = {
accountId +
"/public/QueryProfile?profileId=profile0&rvn=-1"
);
},
killSession: token => {
return "https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/sessions/kill/" + token;
}
};