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
Ref: www.wegversity.com/courseware
FIXED
What could be wrong?
I'm just looking around to try out the oauth authentication method, to possibly try and extend it. Is there any way that I could get this working on local?
about the 500 Internal error, please write an issue in the github tracker issue. We can follow up from there. Don't forget to provide the exact step to reproduce and to mention your environment.
About the plugin not working in local, you can use service like http://progrium.com/localtunnel/ to give online access to a local server.
I research problem and find, what there is error in /auth/googleauth2/auth.php
In line 359 used authenticate_user_login function, that dont work with empty second parameter (password).
Replace
$user = authenticate_user_login($username, null);
-->
$user = get_complete_user_data('username', $username, $CFG->mnet_localhost_id);
or $DB-> get_record function
solve this problem.
Also when reporting issue don't hesitate to turn debug mode ON in moodle, and give the full error message. Also mention your environment it can help to resolve an issue.
On github there is also a wiki/faq: https://github.com/mouneyrac/moodle-auth_googleoauth2/wiki
Thanks
I'm running Moodle 2.5.3+ (Build: 20131115)
I've just installed the plugin. I am able to login with Facebook and Google.
For LinkedIn I'm getting "Error writing to database". Here's the anonymized debug info:
Debug info: Column 'country' cannot be null
UPDATE mdl_user SET email = ?,firstname = ?,lastname = ?,country = ?,city = ? WHERE id=?
[array (
0 => 'linkedinuser@domain.com',
1 => 'First',
2 => 'Last',
3 => NULL,
4 => NULL,
5 => '17',
)]
Error code: dmlwriteexception
Stack trace:
line 426 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 1195 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1227 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
line 371 of /auth/googleoauth2/auth.php: call to mysqli_native_moodle_database->update_record()
line 88 of /login/index.php: call to auth_plugin_googleoauth2->loginpage_hook()
Output buffer: Notice: Undefined property: stdClass::$country in /var/www/vhosts/mysite.com/httpdocs/auth/googleoauth2/auth.php on line 326 Notice: Trying to get property of non-object in /var/www/vhosts/mysite.com/httpdocs/auth/googleoauth2/auth.php on line 326 Notice: Undefined property: stdClass::$name in /var/www/vhosts/mysite.com/httpdocs/auth/googleoauth2/auth.php on line 327
My LinkedIn First, Last, and email address were in the debug info.
Any advice would be appreciated.
Thanks,
Darrel
The authentication provider sent us a communication error. Please try to sign-in again.
Again ... thanks for your work. 'spirit of sharing', Ken
The domain specific login page is due to be depreciated soon, I don't know if this method will be affected.
There is now a theme which shows how to add the buttons to an existing login page. In that theme it would be /layout/login.php where you add had=domain.com
Let me know if you get stuck.
facebook login not work
google+ is very well
how can i solve facebook login ?