Skip to content

After 24h the next token stops working #79

@prapicault

Description

@prapicault

Describe the bug
After 24 hours, the next token stops working

To Reproduce
Steps to reproduce the behavior :

  1. Use the following script:
import * as pronote from 'pawnote';

const credentials = {
  deviceUUID: 'magicmirror-device'
};
void async function main() {
  const handle = pronote.createSessionHandle();
  var sessionData = await pronote.loginQrCode(handle, {
    deviceUUID: credentials.deviceUUID,
    pin: "1234", // 4 numbers you provided in Pronote.
    qr: {"avecPageConnexion":false, "jeton":"D69F7DC6F2D71E3A16BC7FC9EC326B153ECD21F4436B6410A51E77B9BBEA4C009E6F2C86E8AED18017BA9E28D363DA70CAF5F0224F1F011D6C36D9AC434BEDA275CFA9CD6E6C76C36B8FC3C03AB9C0258975B8FEC91B388AF0EE0C99D818C6276398945AF5724840B63FCA787D0AAA81", "login":"E641C7BAD9A59DC9D57C63F1D682895C", "url":"https://pronote-vm.dev/mobile.eleve.html"}
  });
  console.info("Username:", sessionData.username);
  console.info("Next-Time Token:", sessionData.token);
  
  console.log("\n------ TOKEN:");
  
  while (true) {
    await new Promise(resolve => setTimeout(resolve, 10 * 60 * 1000)); // 15 minutes

    const next_handle = pronote.createSessionHandle();
    sessionData = await pronote.loginToken(next_handle, {
      // We use information from last session.
      kind: sessionData.kind,
      url: sessionData.url,
      username: sessionData.username,
      token: sessionData.token,
      deviceUUID: credentials.deviceUUID
    });
  }
}();
  1. Replace the qr data with a valid one
  2. Run the script for 24 hours.
  3. Notice that after 24 hour, the script fails with the exception
Error occurred: SessionExpiredError: The session has expired
  SessionExpiredError: The session has expired
    at new te (file:///home/mirror/MagicMirrorSetup/pronote-info-getter/node_mod
ules/pawnote/dist/index.mjs:1:12264)
    at Object.promise (file:///home/mirror/MagicMirrorSetup/pronote-info-getter/
node_modules/pawnote/dist/index.mjs:1:14119)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5
)

Expected behavior
After 24 hours, the refresh should keep working

Desktop (please complete the following information) :

  • OS: Linux
  • Browser: N/A
  • Version: Pawnote version: 1.6.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcan't reproduceWe can't debug what's going on herehelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions