Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are 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