julian-exile / FortniteAPI

unofficial fortnite api
15 stars 1 forks source link

error by login #4

Closed fiftyy closed 6 years ago

fiftyy commented 6 years ago

Mär 04, 2018 6:01:27 PM eu.ventix.semoxventixbot.SemoxVentixBot main INFORMATION: Teamspeakbot is starting... java.nio.file.NoSuchFileException: configuration\epic_login.json at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230) at java.nio.file.Files.newByteChannel(Files.java:361) at java.nio.file.Files.newByteChannel(Files.java:407) at java.nio.file.Files.readAllBytes(Files.java:3152) at com.xilixir.fortniteapi.v2.Configuration.read(Configuration.java:85) at eu.ventix.semoxventixbot.SemoxVentixBot.doEpicGamesAuth(SemoxVentixBot.java:77) at eu.ventix.semoxventixbot.SemoxVentixBot.main(SemoxVentixBot.java:44) [Sun Mar 04 18:01:31 CET 2018][FortniteAPI] Starting Authentication... Exception in thread "main" java.lang.NullPointerException at com.xilixir.fortniteapi.v2.FortniteAPI.authenticate(FortniteAPI.java:60) at eu.ventix.semoxventixbot.SemoxVentixBot.doEpicGamesAuth(SemoxVentixBot.java:80) at eu.ventix.semoxventixbot.SemoxVentixBot.main(SemoxVentixBot.java:44)

` private static void doEpicGamesAuth() { Configuration login = new Configuration("epic_login", Credentials.class); Credentials credentials = login.read(); FortniteAPI api = new FortniteAPI(credentials); try { api.authenticate(); } catch (IOException e) { e.printStackTrace(); }

    try {
        EpicLookup lookup = api.getUserInfo("HastKeinGeld");
        Stats stats = api.getStats(lookup.getId());
        Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
        System.out.println(gson.toJson(lookup));
        System.out.println(gson.toJson(stats));
    } catch (IOException e) {
        e.printStackTrace();
    }
}

`

nwjefferies commented 6 years ago

oh I changed the filename to epic_login.json If you don't already, you need to have you epic login info saved in a json file in the configuration folder

julian-exile commented 6 years ago

You don't have to, you can store them any way you want. I just used a simple configuration class in my example.

Either way the error occurred because the file didn't exist before you tried to use it.

You can call Configuration#withDefault(Credentials c) to create the file then input the info afterwards by editing the file yourself.

On Sun, Mar 4, 2018 at 2:00 PM, Nicholas Jefferies <notifications@github.com

wrote:

oh I changed the filename to epic_login.json If you don't already, you need to have you epic login info saved in a json file in the configuration folder

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Xilixir/FortniteAPI/issues/4#issuecomment-370254060, or mute the thread https://github.com/notifications/unsubscribe-auth/AS3n9N8Hx7y9SZg25D_3lGfjNmdanqs7ks5tbDmxgaJpZM4SbaH6 .

fiftyy commented 6 years ago

okay? example please............

julian-exile commented 6 years ago

Just look at the code it's very simple. All the information you need is in the existing example, the FortniteAPI constructor, and the Configuration class.

On Sun, Mar 4, 2018 at 2:29 PM, nxtVentix notifications@github.com wrote:

okay? example please............

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Xilixir/FortniteAPI/issues/4#issuecomment-370256376, or mute the thread https://github.com/notifications/unsubscribe-auth/AS3n9EQ7nPozK9YDjhxes8PDoxmMMFEXks5tbECEgaJpZM4SbaH6 .

nwjefferies commented 6 years ago

Using Xilixir's implementation:

Inside the login.json, you should have something like this. { "email":"epic_email@gmail.com", "password":"password", "base64hashPair":"Hash pair from epic launcher", "base64hashPairClient":"Hash pair from launching fortnite" }

If you don't have the hash pairs then you need to use fiddler4 to get them.

fiftyy commented 6 years ago

thank u!!!!!!!!!!!!