Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Classes
oauthlib.php File Reference

OAuth helper class. More...

Classes

class  oauth2_client
 OAuth 2.0 Client for using web access tokens. More...
 
class  oauth_helper
 

Detailed Description

OAuth helper class.

  1. You can extends oauth_helper to add specific functions, such as twitter extends oauth_helper
  2. Call request_token method to get oauth_token and oauth_token_secret, and redirect user to authorize_url, developer needs to store oauth_token and oauth_token_secret somewhere, we will use them to request access token later on
  3. User approved the request, and get back to moodle
  4. Call get_access_token, it takes previous oauth_token and oauth_token_secret as arguments, oauth_token will be used in OAuth request, oauth_token_secret will be used to bulid signature, this method will return access_token and access_secret, store these two values in database or session
  5. Now you can access oauth protected resources by access_token and access_secret using oauth_helper::request method (or get() post())

Note:

  1. This class only support HMAC-SHA1
  2. oauth_helper class don't store tokens and secrets, you must store them manually
  3. Some functions are based on http://code.google.com/p/oauth/
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later