Anon-Exploiter / ine-dl

Python script to download INE courses including labs, exercises, quizzes, slides, and, videos!
MIT License
17 stars 8 forks source link

[Code Change] - Only login with credentials if old JWT has expired #12

Closed Anon-Exploiter closed 8 months ago

Anon-Exploiter commented 8 months ago

The implementation currently is flawed as we're using the user credentials for sign in again and again when executing the script, this enforces rate limiting.

Ideally, the script should:

  1. Login once with the user credentials
  2. Store the JWT returned from the server into the config.json file

When the script is executed again, it should:

  1. Use the old JWT for the requests from config.json
  2. If that JWT has expired, try and request a new JWT from /uaa/auth/refresh-token endpoint
  3. If that fails, then and only then, login with the user credentials

This should help with the rate limiting currently imposed on sign in attempts.