qlaffont / fortnite-api

Fortnite API, Get Stats, News And Status
https://twitter.com/qlaffont
MIT License
354 stars 86 forks source link

Various errors related to "UnhandledPromiseRejectionWarning" #108

Closed chickenputty closed 6 years ago

chickenputty commented 6 years ago

I've used Fiddler 4 to find both oath keys and inputted them correctly. Paired with my correct username and password, I get the following errors:

PS C:\Users\Adam\fort> node .\fortnite.js
Fortnite-API - Credentials Params OK
(node:11480) UnhandledPromiseRejectionWarning: Please enter good token
(node:11480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not han
dled with .catch(). (rejection id: 1)
(node:11480) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Here is the code, leaking the tokens as they are the same for everyone:

const Fortnite = require("fortnite-api");

let fortniteAPI = new Fortnite(
    [
        "my_email@gmail.com",
        "my_password",
        "MzRhMDJjZjhmNDQxNGUyOWIxNTkyMTg3NmRhMzZmOWE6ZGFhZmJjY2M3Mzc3NDUwMzlkZmZlNTNkOTRmYzc2Y2Y=",
        "ZWM2ODRiOGM2ODdmNDc5ZmFkZWEzY2IyYWQ4M2Y1YzY6ZTFmMzFjMjExZjI4NDEzMTg2MjYyZDM3YTEzZmM4NGQ="
    ],
    {
        debug: true
    }
);

fortniteAPI.login().then(() => {
    fortniteAPI
    .checkPlayer("PaulTrooper", "pc")
    .then(stats => {
        console.log(stats);
    })
    .catch(err => {
        console.log(err);
    });
});
chickenputty commented 6 years ago

$ node --version v8.11.3

chickenputty commented 6 years ago

Resolved. This was because my account has 2-auth and it was failing there. Would have saved some time if the error would have printed.