Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Loads/stores oauth2 access tokens in DB for system accounts in order to use a single token across multiple sessions.

Copyright: 2018 Jan Dageförde <jan.dagefoerde@ercis.uni-muenster.de>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 71 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

access_token:: (1 method):
  define_properties()


Class: access_token  - X-Ref

Loads/stores oauth2 access tokens in DB for system accounts in order to use a single token across multiple sessions.

When a system user is authenticated via OAuth, we need to use a single access token across user sessions,
because we want to avoid using multiple tokens at the same time for a single remote user. Reasons are that,
first, redeeming the refresh token for an access token requires an additional request, and second, there is
no guarantee that redeeming the refresh token doesn't invalidate *all* corresponding previous access tokes.
As a result, we would need to either continuously request lots and lots of new access tokens, or persist the
access token in the DB where it can be used from all sessions. Let's do the latter!

define_properties()   X-Ref
Return the definition of the properties of this model.

return: array