Fix needed for the rate limit issue in the GitHub API endpoint 'users/{userName}' within the 'getLocationByUsername.js' file
Description
During my code analysis, I discovered that we are utilizing the GitHub API "https://api.github.com/users/{userName}" and employing the Octokit utility provided by GitHub for making the API calls.
However, I noticed that we are not supplying an authentication token when creating the Octokit object. This is crucial because the API has a rate limiter implemented, which restricts the number of user reads to 60 per hour. Given our requirements, this limit is insufficient.
Here is a screenshot of the relevant code for reference from "getLocationByUsername.js".
See the error while loading the test data.
Proposed Solution:
According to the GitHub rate limiter guidelines, if we include an authentication token when making requests to this API, we will be allowed to make up to 5000 requests per hour. This limit appears to be acceptable for the current situation. However, as the number of users grows, we may need to reconsider this aspect in the future.
To address this issue, let's fix it by adding an authentication token as shown below:
Have a look into detailed documentation for rate limit from GitHub https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting
Screenshots
No response
Additional information
Please consult the following document, Authentication Doc, for detailed instructions on the necessary steps to implement token authentication. This guide outlines the specific procedures required to obtain and utilize the token for reading purposes.
Screenshot for generating the token-
More reference: Follow this youtube video for step by step process.
Happy Coding!
To reduce notifications, issues are locked until they are https://github.com/EddieHubCommunity/LinkFree/labels/%F0%9F%8F%81%20status%3A%20ready%20for%20dev and to be assigned. You can learn more in our contributing guide https://github.com/EddieHubCommunity/LinkFree/blob/main/CONTRIBUTING.md
The issue has been unlocked and is now ready for dev. If you would like to work on this issue, you can comment to have it assigned to you. You can learn more in our contributing guide https://github.com/EddieHubCommunity/LinkFree/blob/main/CONTRIBUTING.md
Good spot Ravi 👍
Someone can add this to the environment variables GITHUB_API_TOKEN 💯
can I work on this?
Sure @Ankur1493 , assigned to you
Thank you for submitting your pull request. I have included a review comment that requires your attention. Additionally, for this particular change, please update the documentation to reflect the modifications. It may also be necessary to provide instructions on generating tokens, if applicable.
Furthermore, please provide details on how you verified this change. In my case, I identified this issue by utilizing additional logs during the test data reload process. I recommend adding extra logs while reloading the test data, specifically within the /api/system/reload?secret=development endpoint. You can refer to the reload.js file for the location API call implementation.