Moodle plugins directory: Oauth2 authentication plugin for Moodle (for Moodle 3.2 and earlier) | Moodle.org
Oauth2 authentication plugin for Moodle (for Moodle 3.2 and earlier)
Plugin end of life 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 highly 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 published in the Moodle.org plugin repository. There will probably be a new Oauth2 category in the Moodle plugin repository. Wait and see...
I will try to mantain this plugin until Moodle 3.1 (LTS) runs out of security upport (13 May 2019).
Warning for Facebook users
The plugin stopped working the 27th March 2017 as Facebook closed the API 2.2. The last versions of this plugin have been updated to support Facebook 2.8 API. As usual carefully test before upgrading a third party plugin if your Moodle site is important to you (especially as it is an authentication plugin)
Installation
- add the plugin into /auth/googleoauth2/
- in the Moodle administration, enable the plugin (Admin block > Plugins > Authentication)
- in the plugin admin page, follow the displayed instructions.
I also created a free mini-course on how to install a Moodle plugin using Oauth2 plugin as example.
Documentation and support
You can search in all existing issues on Github. Go to the issues page, next to the filter button there is a search field. Remove the default content, type your keywords and press enter.
There is a FAQ too.
Alternative plugins
There are many alternatives to this plugin, if you have any trouble with this plugin it may be a good idea to try them:
- Moodle core Oauth2 plugins (Moodle 3.3 and later)
- Elcentra
- LenAuth
- OpenID Connect
- LinkedinAuth
- check the auth plugin list
I just checked https://developers.google.com/accounts/docs/OpenIDConnect it seems to be the same calls/code, I think it will work. They just added some openid parameters into the mix in this documentation. Note that months ago I already fixed the deprecated API in order to use Google+ API. Let me know if there is any issue, it's hard to always follow Google changes, they love changes
The issue "error/couldnotgetuseremail" is back on my page. I didn't any update and use the newest version of this oauth Plugin.
I have activated the "Google+ API" on the Google Developer Console.
Also, I changed the Api key and secret either created a new project on google site, nothing has helped.
As someone an idea what it could be?
Thanks in advance!
-Derek
I have enabled google oauth in our moodle instance
Actually I am using a a customised alternate login url to login to it.
So could you please advice me on how to get the google oauth option in my customised alternate login url to login.
How is it possible to place the sign in button below the login not top of the page? Thanks..
I wonder if you plan to add Twitter Authentication in your plugin roadmap.
If this is not the case, can you just explain the reasons (technical issue, lake of time...) ?
Thanks,
I am planning to do it but I don't think it will arrive before, at least, a month. I am working on this plugin only when I have some free time and the desire to work on it I am currently rewriting the plugin using the popular PHPLeague Oauth2 client library that supports many extra providers (dropbox, instagram, square...). You can have a pick to this new version in the dev branch on github. However as the PHPLeague lib is also an Oauth2 client library it doesn't support twitter. Twitter uses Oauth1 for the authentication process (from my knowledge).
To support Twitter I was thinking using https://github.com/thephpleague/oauth1-client as library. You can follow https://github.com/mouneyrac/moodle-auth_googleoauth2/issues/54
Cheers,
Jerome
We have a problem translating the module for 2.8, in AMOS we cannot see versions greater than 2.5 so the new strings are not included.
Thanks!
Pau
Thanks a lot for your quick response and the links.
I am working on french traduction of your plugin and I have another question about exeption you use in your plugin.
Why don't you use $module parameter when you throw moodle_exception ?
For ex : throw new moodle_exception('couldnotgetuseremail');
Instead of throw new moodle_exception('couldnotgetuseremail','auth_googleoauth2');
Thus, the translation is not taken into account for following error codes : unknown_oauth2_provider, couldnotgetuseremail, facebook_failure, google_failure, linkedin_failure...
Do you plan to add this kind of modifications to the next version ?
Thanks,