I'm writing an authentication plugin for Moodle using Macaroons. Its source code is available here (don't mind the code quality, it's more a proof of concept than anything else, and I'll clean the code later).
I have an issue with this plugin: while the authentication works, when I access login.php, I get the "You are already logged in as [...], you need to log out before logging in as different user" error message. It seems that the authentication happens twice, but I don't see how.
What did I get wrong?
Thanks in advance for your answers!