No new versions are planned starting from Moodle 3.3: starting from Moodle 3.3, Oauth2 should be implemented in Moodle core. It will require you to upgrade to Moodle 3.3 and switch to the Oauth2 core authentication (and probably do some migration), but it is a great news as authentication is a really sensible matter and having Oauth2 plugins in core will guarantee their maintenance. So starting from Moodle 3.3 I recommend to use the new Oauth2 core plugins ((https://docs.moodle.org/dev/Better_Office_Integrations_3.3#Core_API_for_managing_Authorized_OAuth_Applications) ). Missing core providers will likely be implemented by someone and publish in Moodle.org plugin repository. There will probably be a new Oauth2 categories in the Moodle plugin repository. wait and see...
This plugin adds the "Sign-in with Google / Github / Linkedin / Windows Live" buttons on the login page. The first time the user login with a social account, a new Moodle account is created.
PHP 5.5
- add the plugin into /auth/googleoauth2/
- Install composer.phar: curl -sS https://getcomposer.org/installer | php
- Install the 'vendor' folder: php composer.phar install
- apply the changes listed in VENDOR CHANGES.md
- run the Moodle upgrade
- in the Moodle administration, enable the plugin (Admin block > Plugins > Authentication)
- in the plugin settings, follow the displayed instructions. or just install the plugin from Moodle.org repository plugin page
If you have any issues you can follow the Git chapter of my free mini-course how to install a Moodle plugin. It is using the Oauth2 plugin as example.
- add your third party provider for Oauth2 client as explain in https://github.com/thephpleague/oauth2-client
- create /classes/provider/newprovidername.php and newprovidername_redirect.php. Then add the lang strings in /lang/en/auth_googleoauth2.php and add the provider name to lib.php:provider_list (if you have time you can change the function logic to automatically load the classes from the provider folder and then send me a pull request, thanks :))
In order to store the user access tokens, you must set the config with: set_config('saveaccesstoken', 1, 'auth/googleoauth2');
Then you can use them in your own plugin. The Oauth2 plugin also trigger an event on login. You can retrieve the access token from it too.
The plugin does not include the 'vendor' folder as explained by composer best practice. If you need to know more about composer, you can read Composer Namespaces in 5 Minutes