qlaffont/fortnite-api

Error receiving stats

gsaada opened this issue · 7 comments

Error receiving data for any user

async getFortniteStatsNicknameAlltime(nickName) {
    if (!nickName) return null;
    try {
      await this.fortniteAPI.login()
      const stats = await this.fortniteAPI.getStatsBR(nickName, "pc", "alltime")
      return stats;
    } catch (err) {
      return err
    }
  }

returns:

 message: 'Impossible to found stats for this user.', 
  err:
   { Error: Request failed with status code 403
       at createError (/mnt/c/Users/saada/Development/novos-graphql-server/node_modules/axios/lib/core/createError.js:16:15)
       at settle (/mnt/c/Users/saada/Development/novos-graphql-server/node_modules/axios/lib/core/settle.js:18:12) 
       at IncomingMessage.handleStreamEnd (/mnt/c/Users/saada/Development/novos-graphql-server/node_modules/axios/lib/adapters/http.js:201:11)
       at IncomingMessage.emit (events.js:198:15)
       at endReadableNT (_stream_readable.js:1142:12)
       at processTicksAndRejections (internal/process/task_queues.js:81:17)
     config:
      { adapter: [Function: httpAdapter],
        transformRequest: [Object], 
        transformResponse: [Object],
        timeout: 0,
        xsrfCookieName: 'XSRF-TOKEN',
        xsrfHeaderName: 'X-XSRF-TOKEN',
        maxContentLength: -1,
        validateStatus: [Function: validateStatus],
        headers: [Object],
        method: 'get',
        url: 
         'https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/stats/accountId/4735ce9132924caf8a5b17789b40f79c/bulk/window/alltime',
        responseType: 'json',
....

Maybe my IP got blocked?

Yes it seem that you IP or your account is blocked. Have you try to play one game before to use this account to "fake" the activity of your account ? 🤔

Yes, I tried.
Do you have any best practices on how to avoid this blocking?
Does someone ever use this API for many requests?

I've been using this api to send requests every few seconds for the last couple of weeks and haven't been blocked yet

Hey @Hamza141, Shai from @gsaada's team here.
A few questions:

  1. Do you use Fortnite regularly with the same user you make the requests with?
  2. Do you take care of refreshing the tokens or let the library handle it?
  3. Do you make login more than once?

I'll be happy to get any info that might help us understand why we don't get the info.

@qlaffont I think I figured it out
I made a pr #179 with the fix.
Edit: I now see @Hamza141 already PRd it 13 hours ago :)

Yeah I was getting a "Player Not Found" error which I assumed was something due how I was using the api but it turns out that all requests were failing once the token expired so refreshToken was what was causing the issue

Already merge :). Release with 3.3.1