qlaffont / fortnite-api

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

random 401 unauthorized response on lookup(username) #171

Closed tzwaeaen closed 5 years ago

tzwaeaen commented 5 years ago

I think this issue only occurs when you try to lookup stats for a username, id seems to work. I get random 401 unauthorized responses in the lookup() function.

As this is fully random and sometimes works I am not sure what information to provide... :-|

qlaffont commented 5 years ago

Do you have the many 401 with the same user ? And if yes, sometimes it's work ?

tzwaeaen commented 5 years ago

Different users, different results. I just tried to grab the season stats for ninja and spammed the command 4 times in a row. This is the result.

qlaffont commented 5 years ago

Probably the API is not stable ? Strange behavior

guyng commented 5 years ago

@qlaffont it's not that the api is not stable, they added a mechanism that check if you're sending too many requests for more than 14 hours then it automatically respond with unauthorized.

tzwaeaen commented 5 years ago

@guyng api limit based on what? because i can definitely say that I haven't sent to many requests. and when exceeding the limit, when I send 4 requests, why do I get 50% results? and why does this only occur on requests for stats for username and not ids?

guyng commented 5 years ago

@eeeAAAkkk nvm, i found the problem. basically, after few hours you need to resend authentication request and get a new valid token and then even after 14 hours your requests will be authorized. My last check i found out that after around 6 hours you need to request for a new token otherwise your requests will partially be unauthorized. and make sure you don't send too many requests.