External web services tokens being deleted

External web services tokens being deleted

by Tomas De Amos -
Number of replies: 3
Hi Moodle community.

I am writing because I am experimenting and odd behaviour in a Moodle 4.3 version.

I am using a web service wich creates an attendance session for each class.

The problem is that the token is getting deleted after a few days of being used.

I have checked upon creation of the token, that a valid future date is correctly set.

Every now and then I receive notifications from staff that attendance sessions are not being created and when I check in the token administration page (/admin/webservice/tokens.php)I find that the generated token is missing.

I have also tried to look for the token in the mdl_external_tokens with the same luck. It gets deleted for any reason.

Does anyone know why this could happen?

Thanks and regards.
Tomas.

Average of ratings: -
In reply to Tomas De Amos

Re: External web services tokens being deleted

by Devendra Yadav -
Hi Tomas,

Have you checked for any automated processes or scripts that might be deleting the tokens? Reviewing server logs could provide insight. Consider reaching out to the Moodle community or support for further assistance.

Best regards,

(Edited by Howard Miller to remove link - original submission Thursday, 18 April 2024, 10:55 AM)

In reply to Tomas De Amos

Re: External web services tokens being deleted

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The obvious (and so probably wrong) solution would be that you had created it with "Valid until" set to something.

How are you creating the tokens? Also check that you are not deleting anything related that might be taking the token with it.
In reply to Howard Miller

Re: External web services tokens being deleted

by Tomas De Amos -
Thank you for your response, Devendra and Howard.

I have checked the expiry date in the token generation form.

Is it possible that if the token is generated with an admin user, it's being deleted by a scheduled task or process in Moodle? I'm asking because I've created a new specific user with Manager role in the system context, and the token associated with this user hasn't been deleted.

Regards,
Tomas.