Oauth2 authentication plugin for Moodle (for Moodle 3.2 and earlier)

Authentication ::: auth_googleoauth2
Maintained by Sergio Rabellino
Part of set OAuth2.
Sign-in with an Oauth2 provider. The first time you sign-in, a new account is created.
Latest release:
716 sites
113 downloads
272 fans
Current versions available: 3

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

  1. add the plugin into /auth/googleoauth2/
  2. in the Moodle administration, enable the plugin (Admin block > Plugins > Authentication)
  3. 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:

Screenshots

Screenshot #0

Contributors

Sergio Rabellino (Lead maintainer)
Jérôme Mouneyrac: Original author and previous maintainer
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Dominik Stuerzer
    Sat, 12 Dec 2015, 1:28 AM
    Thanks for the great plugin! Is it possible to show the buttons for oauth also on the signup page?
    I want to direct people to the signup from a landing page. They should be able to sign up with Facebook and google...
  • Sourabh Maheshwari
    Sun, 13 Dec 2015, 4:32 PM
    Hi Jerome,

    I am getting the following error:

    401. That’s an error.



    Error: invalid_client

    The OAuth client was not found.

    Request Details
    approval_prompt=auto
    scope=profile email
    response_type=code
    redirect_uri=http://www.saamarthyaved.com/auth/googleoauth2/google_redirect.php
    state=c92cf1e0119c1d3d8b9620c07813500a
    client_id=342837796965-fgv9hodo73agl5e0t9eq9phe31jr94hp.apps.googleusercontent

    also What should be the name of the Product in OAth consent screen.

    Thanks in advance,
    Sourabh
  • Phuong Hoang
    Wed, 16 Dec 2015, 12:39 PM
    Hi guys,
    At first, I failed to install this plugin, but finally it works like a charm. In my opinion, the reason why I failed was that I used the same email as the one I had registered in my moodle site. I'm not sure! Let consider, guys!
  • Lars Richter
    Thu, 31 Dec 2015, 6:13 PM
    Is it possible to receive the userpic of the social media (like g+ or facebook profile picture)?
  • abdoul kassoum Thimobiano Yendanl
    Fri, 8 Jan 2016, 11:22 AM
    Hi i'm new in using moodle and plugins also. This error whe trying to connect with g+ button
    " The site succeed to connect to the selected provider but failed to retrieve your user details. If you are using Google, check that your site administrator has enabled the Google+ API in the Google developer console. It is the most common reason for this error. "
    Can someone help it will very cool thanks in advance.
  • Dinis Medeiros
    Fri, 29 Jan 2016, 8:05 AM
    Can't login with Microsoft. Google and Facebook OK. Any help?
  • Dinis Medeiros
    Thu, 4 Feb 2016, 6:58 AM
    Account
    Any help for this? Using hotmail account!!!
    We're unable to complete your request
    Microsoft account is experiencing technical problems. Please try again later.
  • Pedro Contreras
    Fri, 5 Feb 2016, 1:39 AM
    Is there any way to configure this plugin so that the new user can use her/his email as username insted of the prefix? Thank you.
  • Jay Pfaffman
    Fri, 4 Mar 2016, 2:16 AM
    I've configured Facebook, Gmail, and Github. I don't get any errors, but after I log in and give the app permission, it returns to the home page with "You are not logged in." Do I have to do something to allow accounts to be created? Do I have to use https?
  • Rajesh Kumar
    Thu, 17 Mar 2016, 11:10 AM
    Great plugin!

    But there is a small mistake in documentation. For Messenger redirect domain should be your website name + "/auth/googleoauth2/microsoft_redirect.php". For e.g if your website is www.xyz.com then redirect url should be "www.xyz.com/auth/googleoauth2/microsoft_redirect.php
  • Alosies George
    Fri, 1 Apr 2016, 4:35 PM
    We have been quite happy with this plugin. We moved to a new hosting account and from then facebook login redirects to the same page and prompts from log-in again. Please see this screencast - https://vzaar.com/videos/6729495

    Has anybody faced a similar problem? Please help
  • Ken Task
    Fri, 15 Apr 2016, 12:33 AM
    Been using this plugin ... good work!
    However, am seeing this in apache error logs of server now (broken down for readability - sorry for length):
    Linux CentOS el5PAE PHP 5.5.34 Moodle 3.0.3+ (Build: 20160407)

    core\\event\\user_loggedin Object
    [data:protected] => Array\
    [eventname] => \\core\\event\\user_loggedin
    [component] => core
    [action] => loggedin
    [target] => user
    [objecttable] => user
    [objectid] => 837
    [crud] => r
    [edulevel] => 0
    [contextid] => 1
    [contextlevel] => 10
    [contextinstanceid] => 0
    [userid] => 837
    [courseid] => 0
    [relateduserid] => [anonymous] => 0
    [other] => Array
    [username] => social_user_2
    [timecreated] => 1460649341
    [logextra:protected] => [context:protected] => context_system Object
    [_id:protected] => 1
    [_contextlevel:protected] => 10
    [_instanceid:protected] => 0
    [_path:protected] => /1
    [_depth:protected] => 1
    [triggered:core\\event\\base:private] => 1
    [dispatched:core\\event\\base:private] =>
    [restored:core\\event\\base:private] => [recordsnapshots:core\\event\\base:private] => Array
    Thanks, in advance, for any clue! ;)
  • Dinis Medeiros
    Sun, 24 Apr 2016, 7:03 AM
    I got it working!!
    For Messenger redirect domain should be your website name + "/auth/googleoauth2/messenger_redirect.php". For e.g if your website is www.xyz.com then redirect url should be "www.xyz.com/auth/googleoauth2/messenger_redirect.php
  • Jeff Long
    Tue, 26 Apr 2016, 9:39 PM
    Moodle Upgraded to version 3.0.3, now Google OAuth2 is no longer working.
    Has any one experienced any issues with version 3.0.3 and OAuth2 2.2???
  • Ana Retreva
    Fri, 29 Apr 2016, 10:39 PM
    Hi all! We get this error: auth_googleoauth2/couldnotgetuseremail

    More information about this error
    Debug info:
    Error code: couldnotgetuseremail
    $a contents:
    Stack trace:

    line 190 of /auth/googleoauth2/auth.php: moodle_exception thrown
    line 89 of /login/index.php: call to auth_plugin_googleoauth2->loginpage_hook()

    This happen when trying to connect with facebook

    Could you please help me? It would be apprecited, I've spent too many hours around this problem

    Thanks!
Please login to post comments