Oauth2 and existing users

Oauth2 and existing users

by Laine Phillips -
Number of replies: 7

HI all,

Forgive my non IT wording/knowledge here, but I am looking at having someone install oauth2 on our site (2.7.2). In the plugin documentation  it mentions that when new users use oauth2 a new Moodle account is set up. What happens with existing Moodle users? Are they able to use the plugin to link their Facebook or Google account to their current Moodle account?

Thanks.

Laine

Average of ratings: -
In reply to Laine Phillips

Re: Oauth2 and existing users

by Ken Task -
Picture of Particularly helpful Moodlers

Have this running on a couple of sites.   It does create a new Moodle user.that follows 'pattern' like 'social_user_#' for the 'username'.  For each new user the # increases.  On sites where users already existed the user does end up with two accounts.   Since EMail addresses are typically hidden and in most user pick list the account firstname and lastname are the only things shown for each user, one sees what appears to be duplicate accounts.   Work-around for this ... ask the user to login via Google and then edit profile in Moodle  (if allowed to do so) and add a (G) after the last name.

For the official response and more info, see:

https://github.com/mouneyrac/moodle-auth_googleoauth2/wiki

Another observation.   User logs in using say Google+, does Moodle things, etc. and then signs out of Moodle.   User is still logged onto Google.

'spirit of sharing', Ken


In reply to Ken Task

Re: Oauth2 and existing users

by Ntec Group -

Hi Ken,


I'm using google authentication and can't find the way how to make username the same as email for new users. Is it possible to do so?


Thanks!

In reply to Ntec Group

Re: Oauth2 and existing users

by Ken Task -
Picture of Particularly helpful Moodlers

The plugin I use is:

https://moodle.org/plugins/auth_googleoauth2

It sets up usernames with 'social_user_#' where # is a number from 1 to whatever sequentially.   The username nor email address isn't used to login to Moodle using the normal login box if authenticating vs Google ... one clicks on an image that begins the login process with Google ... which uses EMail address and that sends you back to the Moodle after authenticating.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Oauth2 and existing users

by Ntec Group -
hmmm, I see. Thanks for your reply.

The reason I wanted to have username the same as emails is to make user upload easier. I'm enrolling students in multiple courses using user upload function and by default Moodle is using username as a user identifier, means that when I generate CSV file with a list of students and respective courses from our student management system I need to add Moodle usernames to that CSV file to be able to enroll students in courses in Moodle. So I thought if it's possible to make username the same as email then it will reduce the time on adding username from Moodle, because our student management system has only student emails as ID and cannot communicate with Moodle to get usernames.

Is there any other way of bulk enrollment to multiple courses where I can use email as user identifier?



In reply to Ntec Group

Re: Oauth2 and existing users

by Ken Task -
Picture of Particularly helpful Moodlers

In your server ...

http://yoursite/admin/settings.php?section=manageauths

There is a setting for 

Allow log in via email authloginviaemai which has as a comment:

Allow users to use both username and email address (if unique) for site login.

However, if you are using the same plugin I am, it still might be possible to use a csv file from your student information system ... even if it doesn't use 'social_user_#' by manipulating the csv yourself.

Like I said the plugin I use gives those usernames sequentially ...

social_user_1

social_user_2

etc..

One could find the last social_user_# entered in the mdl_user table, and in the csv file you to use to import **new** students add a column in a spreadsheet app that concactates 'social_user_' with the next number sequentially beginning with the last number seen in the dump of the mdl_user table.

The problem stuff would be a student already enrolled in the moodle who had a name/info change in the SIS.

How 'flexible' is your SIS?   Maybe a field could be added that matched the requirements for social_user_# where # is sequential.

Don't think there is an easy answer ... without some human manipulation.   However, maybe if you study it a bit, you might come up with your own idea and run it by whoever runs your SIS.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Laine Phillips

Re: Oauth2 and existing users

by Albert Leatherman -

I too would like to be able to allow students to link their Facebook accounts to their existing Moodle accounts. Any news on this front over the past year? Thx