Giter Site home page Giter Site logo

rabser / moodle-auth_googleoauth2 Goto Github PK

View Code? Open in Web Editor NEW
77.0 77.0 81.0 2.63 MB

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

License: GNU General Public License v3.0

PHP 49.50% JavaScript 1.00% CSS 5.04% Gherkin 0.51% HTML 43.95%

moodle-auth_googleoauth2's People

Contributors

ardanzap avatar avindra avatar crazyserver avatar dasistwas avatar dmatora avatar fmcorz avatar hanleym avatar jamesmcq avatar kevin-bruton avatar kmiksi avatar leblangi avatar mouneyrac avatar nadavkav avatar netdreamer avatar rabser avatar rajivnavada avatar roginvs avatar rrusso avatar silviabastos avatar vitalyrepin avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moodle-auth_googleoauth2's Issues

Secure Buttons

On a secure server the login buttons are parsing as http not https how can I change those buttons to parse as https.

Report of the plugin not working in 2.5.2+

https://moodle.org/plugins/view.php?plugin=auth_googleoauth2

Regul RedTue, 24 Sep 2013, 10:01 PM
This plugin not work in my Moodle 2.5.2+

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.

Google Oauth2 users can login without passwords.

Logins with Google Oauth2 are working fine, however, I have manual auth enabled as well for some other users and anyone can login to any of their accounts by using the generated username and any / no password.

It seems this is the only check in the user_login() function:

//username must exist and have the right authentication method
if (!empty($user) && ($user->auth == 'googleoauth2')) {
    return false;
}

Possible Solution:

//username must exist and have the right authentication method
if (!empty($user) && ($user->auth == 'googleoauth2')) {
    $code = optional_param('code', false, PARAM_TEXT);
    if($code === false){
        return false;
    }
    return true;
}

Google sign on configuration and googleoauth2 plugin issue

I have installed googleoauth2 plug-in on an vanilla instance of moodle 2.6.2. I configured google sign-on and could see the button on the login page, however there seems to be a couple of issues i.e.

1.I cannot test this on my local environment as the google authentication service does not seem to work with a private IP (my internal IP)

2.Enabling Oauth2 seems to have turned off the other normal form based authentication as well as my email self-sign-on module (so I cannot login to my own site now to do any changes !)

Please help !

Problem with "Windows Live Authentication"

Hello,

I found a problem with the "Windows Live Authentication".

At file auth.php, at line 122 you have:

$postreturnvalues = $curl->get('https://oauth.live.com/token?client_id='.$params['client_id'].'&redirect_uri='.$params['redirect_uri'].'&client_secret='.$params['client_secret'].'&code='.$params['code'].'&grant_type=authorization_code');

But this doesn't work for me, I should use:

$postreturnvalues = $curl->get('https://oauth.live.com/token?client_id=' . urlencode($params['client_id']) . '&redirect_uri=' . urlencode($params['redirect_uri'] ). '&client_secret=' . urlencode($params['client_secret']) . '&code=' .urlencode( $params['code']) . '&grant_type=authorization_code');

I have created a fork.
Best regards.

500 Server Error - Dangerously writable - error/auth googleoauth2/couldnotgetgoogleaccesstoken

Hi,

Thank you for making this. This is great. I am having a small problem that its probably simple to fix but I cant figure it out. I tried it in two sites to see if the problem was one of my sites. They are both hosted at Justhost.com. I am getting this same error on my two sites with both Google and Facebook, but the Windows Live is working fine. I am thinking its my security settings but not sure.

500 Server Error

A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again.
URL: http://cursosctc.com/moodle/auth/googleoauth2/facebook_redirect.php?code=AQAC-rVSfF6SemxJ9Txwc61HUh9SsYRgqDcNgkDXKrJVV8jplAiTnHFPs67o_66CCMkWDhp6pa_Dcwabvwu4LldunRYtF5_sACsBRKPyX3mGSPpI_bqS8jLmNr0tOzUGwM3wBoq9JdskXqycNirwe1T7xjQ3EuD2JXkVmFhvPgnd4lJBEfX3WuXAV23rBNFPhGsi9YqjDaDZPoQGlrzkPxRaArvIro9tvLe3T7pzuCCqOB4UAD-E_aUXipAhj3A_hl1YPArgX8SJe48vts0rPIGl6DjTA
Dangerously writable: [/home3/cursosct/public_html/moodle/auth/googleoauth2/facebook_redirect.php]
FIXED

Only one time authenticating

I successfully installed facebook, google+ and github buttons but once I logged in with one of them (g+ in particular) the other two disappeared. Only if I use another chrome user I can see the 3 of them.

I disconnect, I remove the account but nothing. Only the one is shown!

As you see in the image, I am not logged in, but only one button is shown

image

allauthproviders

Any chance of adding a config option to show all auth providers by default?

Abnormal behaviour of login - after initial login where I can see 3 logos, now I see only one logo

Hi Mouneyrac
The first time I go to my Moodle's login page, I can see all three logos: Google, FB and Live. Then if I login using the Google icon, I can get it, it works, but if I logout and then re-login, I see only the Google icon on my Moodle's login page. If I click the "Use other signin with other service" link, I still see only the one Google logo. So if I wanted to sign in using my FB account, I can't.

Help!
Frankie Kam
http://moodurian.blogspot.com

Problem with cookies- Google authentication

I finally succeeded to make Google authentification to work. But there is still one problem. When I clear Cookies I am able to sign in to Moodle using Sign-in with Google button, and after two logins, I am not able to log in again using the same browser, but after cleaning the cookies I can log in again (but only twice), and so on. Do You have any idea how can I fix this issue? I am using Moodle 2.3.3+ on Debian. Thak You.

Regards,

Sabina

No layout.php file in Standard theme

Hello Jerome, I found no layout.php file in my theme (Standard theme - for new browsers), there is also no login.php file.
Should I put the code in the general.php file of the Theme and then create a login.php file with your code inside? If so, what would be the proper code to include login.php in the general.php file? Thanks for your help, Marina

google redirect to index of dir_list

Hello,
I installed this plug-in and set up google api,
fill in the client_ID, secret, redirect url,login theme etc...
After I press the google "Allow Access" button,
It redirect to the index of file-list in moodle/auth/googleauth2/
(a security risk?)
thank you very much.
My moodle version is 2.0.3 on a mowes_portable(apache22,php535)

Abnormal behaviour of login Part II - if I don't clear my browser cache, anyone who uses my PC can log in as me by clicking one of the Social Networking logo login icons

Hi Mouneyrac

I'm using Google Chrome.

  1. I managed to login using my Google account into my Moodle site.
  2. Then I logout and login as the Moodle admin user.
  3. I delete my Moodle Google-user (the moodle account with my Gmail account in it).
  4. I then logout from my admin account. I can only see the Google logo.
    I can't see the other two FB or Messenger/Live/Outlook.com logos.
  5. I click on the Google login icon and I'm back in again!!
  6. Shouldn't the plug in force me to re-enter my Gmail username and password?
    Seems to be a dangerous security issue here - if I don't clear my Chrome's browser cache, this happens. If I clear my chrome's cache, the username and password fields
    appear. So if I don't clear my chrome's cache, I could be asking for trouble.

BTW, the same thing happens if I choose to do my initial login with FB. Or with Messenger/Live/Outlook.com.

Kindly advise, help!
Frankie Kam
http://moodurian.blogspot.com

Linkedin bug

Hi! Thanks for the plugin. It's awesome! :)

But i've tested a Linkedin provider and got "Error writing to database".

Current JSON from Linkedin:
{
"emailAddress": "*******@gmail.com",
"firstName": "Dmitrii",
"lastName": "Metelkin",
"location": {
"country": {"code": "au"},
"name": "Sydney Area, Australia"
}
}

So, the following lines should be like this:
https://github.com/mouneyrac/moodle-auth_googleoauth2/blob/master/auth.php#L326
$newuser->country = strtoupper($linkedinuser->location->country->code);

https://github.com/mouneyrac/moodle-auth_googleoauth2/blob/master/auth.php#L327
$newuser->city = $linkedinuser->location->name;

Cheers,
Dmitrii

newbie question: coulnd not get google access token?

Hello (bonjour),

I'm not a developper but hopefully I have a small git account.

I am running moodle stable release 2.5.1 and installed OAuth2 about 2 month ago.

What I did

  • I'm interested by google and facebook services so I did create dev account. Also I filled in the client ID & secret in the plugin's settings. (copy paste to be sure)
  • read most documentation I could get on the plugin (first the readme file)
  • checked that I was not trying to connect with an existing account.
  • checked my client ID and secret ;
  • changed http to https in the api console for google.
  • posted in moodle forum (no reply)
  • reinstalled the plugin
  • waited, tryed again...

What I did not do:

  • extensively checked the code.
  • have a similar plugingwork else where. I'm a newbie
  • and many other things... :o)

The error:

With google

I get the following error message after clicking the google button. and entering a valid login/pwd.

The authentication provider sent us a communication error. Please try to sign-in again."

My problem could come from
bash pauth.php:392: throw new moodle_exception('couldnotgetgoogleaccesstoken', 'auth_googleoauth2');

With Facebook:

  • I enter a login/pwd
  • I accept to give info to the plugin
    Then I get the same error as with google.

I need your help
Thank you

Quefaire?

LinkedIn "Column 'country' cannot be null"

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 => '[email protected]', 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

Moodle 2.0 => 2.X continueous testing

setup a continuous testing server for different Moodle branches.

Basically for the moment:
a) write behat tests for each version (may be the same)
b) automatically run the tests once a week (every new release).

plugin requirements

Hi,
I'm trying to find out why the plugin is working on a french host (ovh) and not on my prefred host (bluehost).

Can you tell me the technical requirements for this plugin?
I mean php modules, version that should be installed on the host?

Thanks.

Facebook_redirect.php

Hey mates, I got this error does anyone knows how to fix?

error/facebook_failure

Meer informatie over deze fout

Debug info:
Error code: facebook_failure
$a contents:

Stack trace: line 11 of /auth/googleoauth2/facebook_redirect.php: moodle_exception thrown

this is in the facebook_redirect.php

alternateloginurl)) { $loginurl = $CFG->alternateloginurl; } $url = new moodle_url($loginurl, array('code' => $code, 'authprovider' => 'facebook')); redirect($url); ?>

Better readme to explain the usability decisions

In the readme add a specficiation section, explaining what are the red routes (critical use cases). For example what are the user expecting when they already have an account but with a different email... If it's too big then write a wiki page.

A new ticket is reported in tracker [{$a]}

Mouneyrac!

After posting a ticket, the subject in my E-mail notification reads:

A new ticket is reported in tracker [{$a]}

The code "[{$a]}" appears on my E-mauil subject list. Shouldn't it be a description or name of the Ticket instead of some obscure code?

Regards
Frankie Kam

new provider

Hi,
I want to use this plugin for a provider that's not one of those supported. It's one that's unlikely to be needed by others so I plan to add fields for a "custom" or provider.

Do you think this is possible? Do you have an pointers for where to get started with the code and what's the best way to contribute back?

Andrew

Plugin-settings page freezes/blank page

Thanks for a great plugin! And for a quick first respons on the comments page.

I tried the earlier version with success.
Today when I tried to install yesterday's new version of the plugin on my newly updated moodle 2.5.2 (Build: 20130909), it installed without problem, but when I go to the plugin's settings page, all I get is a blank screen. Having switched debug mode on gives me:

Parse error: syntax error, unexpected '[', expecting ')' in .../moodle/auth/googleoauth2/auth.php on line 467

Any ideas on how to proceed to get it fixed?

Cheers,

Johan Nyman

Unable to go beyond Edit profile page

I have implemented GoogleOauth2 on a live site, but due to some reasons the login gets redirected to edit.php page on moodle.
Even facebook, google, windows live send the authentication back to moodle, but due to some reason the user is not able to go beyond edit profile page.
All the parameters for GoogleOauth2 have been set correctly via admin panel.

Please suggest what needs to be done.

The authentication provider sent us a communication error.

I have a problem with OAuth2 authentication for Moodle. I am currently using Moodle 2.3.3+. I have added OAuth plugin to Moodle. I followed all of the instructions and when I am singing in with Google, after clicking on Accept (Accept that this app will see my e-mail address and basic info about my acc) I get the following error from Moodle: "The authentication provider sent us a communication error. Please try to sign-in again."

Debug info:
Error code: couldnotgetgoogleaccesstoken
Stack trace:

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

Output buffer: Notice: Undefined property: stdClass::$access_token in /opt/rubystack/apps/moodle/htdocs/auth/googleoauth2/auth.php on line

restrict auth. from a google_domain

Hi,
nice to meet you.
is it possible to add a "domain" option in the configuration page,
that only accounts in a certain google_domain can register or login moodle?
thank you !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.