This quick patch automates the user registration and login method - moreover, it uses a different technique to authenticate. It visits linkedin login screen only once (by default, this module sends the user twice to the linkedin website).
Anonymous user clicks on linkedin button -> authenticates at linkedin.com -> automatically user gets created and logs him in.
Registered user clicks on linkedin button -> authenticates at linkedin.com -> the current drupal account gets connected with linkedin. Next time on-wards, he can login via linkedin.
Anonymous function was written/modified by my senior, bpadhu (http://drupal.org/user/619388) - I further modified it to add authenticated user functionality.
Comment | File | Size | Author |
---|---|---|---|
#64 | linkedin-auto-login-d7-1542130-64.patch | 6.99 KB | TuWebO |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedHi Amrit, thanks for this. I'm currently using D7, would it be possible to do a patch for that version too? I would love to test that one.
Comment #2
amrit_b CreditAttribution: amrit_b commentedKline, is there any difference in the linkedin_access_token() {linkedin.inc file} between D6 and D7 version? I didn't get time to check. If they both are same, then you can try this patch in D7 - let me know how it goes.
Comment #3
dellicl CreditAttribution: dellicl commentedHi!
I tried to apply this but I get error messages and cannot implement the patch to the module. This is just the thing I need for my site so I would really like this to work. I have patched modules before but this is the first time I get error-messages even though I think I am doing everything right.
Has anyone else tried this patch? Is it working?
Comment #4
amrit_b CreditAttribution: amrit_b commentedyou found the error while patching or inside drupal? which version are you using?
Comment #5
dellicl CreditAttribution: dellicl commentedWhile I was patching the latest dev-version of LinkedIn Integration module on my development site. When I try to run the patch I get this error:
Hunk #1 FAILED at 15.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 41.
Hunk #4 FAILED at 513.
4 out of 4 hunks FAILED -- saving rejects to file linkedin.module.rej
I am using Drupal 6.25 if that is any help. It would be really helpful if I could get this patch to work - because automated user creation while logging in with your LinkedIn account is just what I need!
Comment #6
amrit_b CreditAttribution: amrit_b commentedOh God! what have I done!! I am so sorry folks! I was in hurry and submitted a wrong patch. Applied on D7, but its a D6 patch :p
Here is the correct one. Please check and let me know if it works of not..
Thx
Amrit
Comment #7
dellicl CreditAttribution: dellicl commentedHi!
I am having hard time understading your replies. Is this patch for version 6.x-1.x-dev like the title says or is this patch for D7 version of the module?
I am using D6 for my site and I would like to know if there is a way to automatically create user accounts when ppl use LinkedIn Integration module to sign-in to my site.
I also tried your new patch: it didn't work. I got over 20 Hunk-errors.
Comment #8
amrit_b CreditAttribution: amrit_b commentedyeah this patch works well with the D6 version of linkedin module. How come are you getting errors? I tested it once again and its working for me.. These are the commands btw
,
Comment #9
dellicl CreditAttribution: dellicl commentedHey!
I managed to patch the 6.x-1.0-beta1 version of the linkedin integration module with your patch. First time I tried to log in a new user to my site with an LinkedIn account it worked great! After that I tried it again and it started to give me "Linkedin debug : 401 : No LinkedIn account is associated with this user" -error message (even though I still managed to log that user in to my site).
After that I decided to try the latest dev-version of LinkedIn integration and I tried to apply the patch to this version as well. This didnt go so well and while I tried to apply the patch I get this error message: "-bash: line 28: auto_login-1542130.patch: No such file or directory."
This is where the weird part comes in: when I deleted the dev-version of the LinkedIn Integration and replaced it with the beta1-version and tried to apply the patch again - it gives me the same error!
This is extremely weird. The commands and filenames etc. are correct and the path/filename is correct.
The command I am using for patching is the basic patch command: "patch -p1 < auto_login-1542130.patch" while being at the linkedin module folder. I have also tried other ways to apply the patch (full file path etc. in the command, but the outcome is always the same.)
Comment #10
amrit_b CreditAttribution: amrit_b commentedHmm.. Just disable linkedin debugging, it won't show the error :p and will work fine.
Regarding your patching issues, are you new to patching..? I personally put the patch file at sites/all/modules , so that the path becomes sites/all/modules/auto_login-1542130.patch - I do this because I don't need to download the patch again again I change the linked in module.. and after that I execute the shell commands I showed in #8
Its obvious that, when ever you delete / replace the linkedin module with a different version, the patch gets deleted (if you put the patch inside module/linkedin/ directory). This is the reason you get "........login-1542130.patch: No such file or directory"
BTW, do you work in a Finnish company? Coz even I work in a Finland based company :p
Comment #11
dellicl CreditAttribution: dellicl commentedOf cource the patch gets deleted. That is the reason why I have the patch donwloaded to my computer and I just put it back to the module folder after I have deleted and replaced the module with a different version.
About disabling the debugging... Yes I know that, but the problem is not only that simple, because even though your patch worked once - the second time I tried to log in using LinkedIn it directed me to the user account profile page where the module wanted to know do I want to link this account with this LinkedIn account. This is why I wanted to try the patch with the latest dev-version of the LinkedIn Integration because if the user automatically gets an user account after he logs in with LinkedIn account there should be no need for asking if the user wants to link his account with LinkedIn (cuz the user account is already created when he logged in via LinkedIn).
Because the way I understood this is that this patch should make the "Log in using LinkedIn"-function work like the "Log in using Twitter" where you log in using your Twitter-account and then your account is created - no need to verify if the accounts are linked afterwards.
Comment #12
nafmarcus CreditAttribution: nafmarcus commentedAny chance of getting this patch for Drupal 7?
Comment #13
rami attallah CreditAttribution: rami attallah commentedHello Folks
I'm really lost here is this a patch for D7 or D6 ?
Cheers
Rami
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedD6, unfortunately. Also any idea what went into linkedin june 2nd update for D7 dev?
Comment #15
amrit_b CreditAttribution: amrit_b commentedHey I would love to port this to D7 - but not getting enough time... Let me see, if possible, will do it on this weekend.
Thx
Amrit
Comment #16
vyomkesh CreditAttribution: vyomkesh commentedHi Amrit, any updates regarding porting it to D7?
Comment #17
Oceanman CreditAttribution: Oceanman commentedSince the patch here is for D6 I changed the Version. It is otherwise very confusing.
Comment #18
mxwitkowski CreditAttribution: mxwitkowski commentedAmrit, would be willing to help out on porting this patch to D7. I'm not much of a programmer, but willing to help out with testing, etc.
Comment #19
amrit_b CreditAttribution: amrit_b commentedAllright, finally I got some timw to write the patch for D7. Haven't tested it though (hoping mxwitkowski will do some testing!)
Thx
Amrit
Comment #20
amrit_b CreditAttribution: amrit_b commentedPlease use this one.. Its patched upon the 7.x-1.x-dev dated 02 June, 2012.
Comment #21
amrit_b CreditAttribution: amrit_b commentedComment #22
mxwitkowski CreditAttribution: mxwitkowski commentedamrit_b -- downloaded and applied the patch, all good so far. I will continue testing and report back any issues.
Comment #23
mxwitkowski CreditAttribution: mxwitkowski commentedamrit_b -- completed some initial testing and attempted to login a new user with LinkedIn. Received the following error:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, pass, mail, created, status, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 18 [:db_insert_placeholder_1] => $S$DMDxJnIGgodFTMTIoYO1Ud9XRbu54a.GFM1D9TksnDQ4eiuKTTTb [:db_insert_placeholder_2] => no_email@address.com [:db_insert_placeholder_3] => 1341544486 [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => a:3:{s:7:"contact";i:1;s:34:"user_relationships_ui_auto_approve";a:0:{}s:40:"user_relationships_allow_private_message";s:12:"on all users";} ) in drupal_write_record() (line 7013 of /Applications/MAMP/htdocs/includes/common.inc).
Comment #24
mxwitkowski CreditAttribution: mxwitkowski commentedamrit_b -- second test was to allow a current site user to link to an existing LinkedIn account in the 'You must first authorize LinkedIn integration to use related features.' Looks like I was successful in associating the LinkedIn account with the Drupal account, but several errors were displayed during the process:
Notice: Undefined index: id in linkedin_profile_user_load() (line 117 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin_profile.module).
Notice: Undefined index: is-current in include() (line 14 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 17 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: title in include() (line 18 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: company in include() (line 21 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: start-date in include() (line 28 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: end-date in include() (line 39 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: summary in include() (line 52 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 14 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 17 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: title in include() (line 18 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: company in include() (line 21 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: start-date in include() (line 28 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: end-date in include() (line 39 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: summary in include() (line 52 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 14 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 17 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: title in include() (line 18 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: company in include() (line 21 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: start-date in include() (line 28 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: end-date in include() (line 39 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: summary in include() (line 52 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 14 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 17 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: title in include() (line 18 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: company in include() (line 21 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: start-date in include() (line 28 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: end-date in include() (line 39 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: summary in include() (line 52 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 14 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 17 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: title in include() (line 18 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: company in include() (line 21 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: start-date in include() (line 28 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: end-date in include() (line 39 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: summary in include() (line 52 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 14 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 17 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: title in include() (line 18 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: company in include() (line 21 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: start-date in include() (line 28 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: end-date in include() (line 39 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: summary in include() (line 52 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 14 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: is-current in include() (line 17 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: title in include() (line 18 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: company in include() (line 21 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: start-date in include() (line 28 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: end-date in include() (line 39 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Notice: Undefined index: summary in include() (line 52 of /htdocs/sites/all/modules/linkedin/linkedin_profile/linkedin-user-page-position-item.tpl.php).
Comment #25
mxwitkowski CreditAttribution: mxwitkowski commentedamrit_b -- third test, I edited the LinedIn configuration page and changed LINKEDIN FIELDS on the USER PROFILE INTEGRATION section and after I unchecked all of the fields (saved the configuration) and then rechecked several items and saved again. After this, the errors mentioned in #24 have not been showing.
Comment #26
amrit_b CreditAttribution: amrit_b commentedHey thanks mxwitkowski. Will check on these errors again this weekend.
Comment #27
DrupalHiT CreditAttribution: DrupalHiT commentedHi,
Honestly, I'm working with Drupal for two weeks and I'm a little "confuse". I'm trying to understand what I have to do for an anonymous user can click on the login linedin Button for authentification (linkedin window open) then return in a new page on the website to fill a form that will be save in a MySql db, not in drupal.
So, the patch you are working on can it do the job ?
Regards
Michel
Comment #28
mxwitkowski CreditAttribution: mxwitkowski commentedamrit_b, completed additional testing and narrowed the use case that triggers the error in comment #23:
Hopefully this info helps to narrow down the error and repair.
Comment #29
amrit_b CreditAttribution: amrit_b commentedThanks! Now it looks nice.
If you are logging into linkedin.com and closing the tab (without manually clicking on logout button) - keeps you logged in (in the cookies I guess). I assume you know this, but just in case ;)
Will check and reply with the new patch.
Thx
Amrit
Comment #30
mxwitkowski CreditAttribution: mxwitkowski commentedamrit_b: I started comparing the D7 patch to the D6 patch and found some critical missing code in and around line 131 in the linkedin.inc file near the comment line
// Now we have linkedin access... Get the user information and create a user...
Also, I dug a bit deeper and saw that the code in the linkedin.inc file around the following comment is also missing in the D7 patch and is needed:
//Check if the same LinkedIn account is not already tied to another user
I am trying to adjust things on my end, but I am not much of a programmer and am introducing several other new errors in the process. . .
Comment #31
mxwitkowski CreditAttribution: mxwitkowski commentedamrit_b, how are you making out with this patch? Ready to test as soon as it is posted.
Comment #32
rausku CreditAttribution: rausku commentedI have played around a bit with the D6 patch.
I don't know if this is fixed in D7 patch, but what should happen when many users have the same name? For example - if a person with username John.Smith is already registered, and another one with the same name tries to register, how are they distinguished between? Using this patch I could access this existing account when I created a LinkedIn account named John Smith and registered in my Drupal site!
Also, it is safer to generate password with user_password function than to set it simply as 'password'.
-
Overall, this method of registration seems quite problematic, as it's currently not possible to retrieve the user's email address from LinkedIn. Email addresses are individual, so they are great for user names when generating them automatically, but LinkedIn doesn't offer them through their API for whatever reason.
I think there should be a step in the registration process which asks for the user's e-mail and after that generates the user, unless LinkedIn changes their policies.
Comment #33
nafmarcus CreditAttribution: nafmarcus commentedThat's exactly what I do, i.e. ask for an email address.
But LinkedIn just released a new authentication method that will ask the user for their email address and presumably pass it back to the requesting application.
They just sent mail yesterday.
Comment #34
amrit_b CreditAttribution: amrit_b commented@nafmarcus can you post the API link please?
@mxwitkowski Hey man how are you doing? First, thanks a lot! I truly appreciate. I am so sorry for not giving time to this. Have been extremely busy for last few days. I saw that you have written so many patches yourself, so why don't you give a try. Its really easy. You can ask me quick questions via email anytime.. I have this sat and sun days free. Let me see if I can do something on this or not.
Thx
Amrit
Comment #35
nafmarcus CreditAttribution: nafmarcus commentedHere's what I received from LinkedIn
And if you go to this page, https://developer.linkedin.com/documents/authentication, you'll see that they now request permission to release the users email.
Comment #36
danteblitz CreditAttribution: danteblitz commentedHas anyone been able to allow user registration via linkedIn now that linkedIn allow email permissions?
Comment #37
Cromian CreditAttribution: Cromian commentedI kind of got confused as I went over this thread. Has anyone been able to successful accomplish this? And would someone be kind enough to share there "linkedin.inc" file with the patched up code? I'm not much a coder when it comes to Drupal. More of a theme/site designer when it comes down to things.
And does anyone know of a program that automatically adds Drupal patches to the existing code?
Thanks!
- C
Comment #38
tamerzg CreditAttribution: tamerzg commentedI took patch from #20 and fixed the error mentioned in #23. Also I added permission for email and now when users log in through Linkedin we will save their Linkedin email address.
Patch is attached and for those who don't want to bother with applying the patch can take the working modified version of this module at http://www.zoubi.me/blog/drupal-7-linkedin-login-module
Comment #39
ckngAttached is a simplified patch of above patches for D6, D7 should trivial with update to db calls. Added hook_linkedin_user_save($account, $liuser) so other modules can make changes to user, e.g. content profile.
However, IMO the module should be rewrote to be cleaner instead of one big linkedin_access_token() function.
To Do:
- make it as an option to create user
Comment #40
ramazanaman CreditAttribution: ramazanaman commentedI kind of got confused as I went over this thread.
Comment #41
ckngTested patches #20, #38, both not working for me (after backport to D6). Hence I created a working copy #39.
Comment #42
TimoSpijkerboer CreditAttribution: TimoSpijkerboer commentedThx ckng. I have installed your version #39. However, I still suffer the duplicate entry error in the following case:
Someone logins using LinkedIn who's profile has not yet been linked. Hence, a new user is created. However, if the email address already exists, a duplicate entry error appears.
Comment #43
finmccarthy CreditAttribution: finmccarthy commentedHi @Tamerzg
I have downloaded the patched module in #38 from zoubi.me and set it up. Just wondering, for a first time user it creates the account fine but doesn't actually log the user in. ie if i use a new account and click on log in with linked in, the account is created and the page is redirected to the new user account page eg /user/3 but the page shows permission denied - if i again click on login with linkedin it works great on all subsequent visits.
Is there some way to get around this in your knowledge?
Thanks
Fin
Comment #44
finmccarthy CreditAttribution: finmccarthy commentedTook a while to get my head around this - but here is the answer I came up with
There is actually no call to login right after a new user is created from linkedin, to correct this add the following 2 lines at line 153 in the patched linkedin.inc file
Comment #45
andykisaragi CreditAttribution: andykisaragi commentedIn case anyone else wants it, here's a D7 version of patch in #39.
Comment #46
finmccarthy CreditAttribution: finmccarthy commentedTo anyone using the patches on this thread - please be aware that most of the patches are creating a user with a plaintext password of "password"
'pass' => 'password',
This is obviously a security issue
FYI
Comment #47
sarfraz742 CreditAttribution: sarfraz742 commentedI am running the dev version for Drupal 7.x. I have a valid API key and secret code for LinkedIn. I've added this to the LinkedIn configuration in my site.
I click on the LinkedIn link in my site login page to Go to LinkedIn to make the connection. After putting User Name and password It redirects me immediately to my site login page with out login into my drupal site.
When i again follow the same above mentioned process than i log in into my drupal site, but i am unable to get my linked in profile info in my custom module through $account variable. I need that linked in profile info in $account array.
Any answer will be appreciate.
Thanks
Comment #48
nafmarcus CreditAttribution: nafmarcus commented#46: I would call that an understatement, having everyone on the site with an identical, obvious password. I spent a panic-ed Saturday night fixing this. Wish I had realized it sooner.
Comment #49
nozies CreditAttribution: nozies commentedI added some basic validation before inserting new account, ie. when user unlink account and tries to log in again with the LinkedIn or user with same name/email already exists.
Comment #50
visabhishek CreditAttribution: visabhishek commented#49 is working fine for me.
i added a user mail with message which contains the random generated password.
For password , you must create a password token on the basis of http://drupal.org/node/1165126, and add in user mail template.
Comment #51
allabakash.g CreditAttribution: allabakash.g commented#50
After Applying this Patch mail_password_after_adding_new_user-1542130.patch.
I am able to create a user account, but not able to log in the first time.
So I have modified the code in "LinkedIn.inc"
Now it creates a user as well as logged in,
please review
Comment #52
phponwebsites CreditAttribution: phponwebsites commentedI used above 4 patches. But still i can't login using linkedin.
Comment #53
le72phponwebsites, if you are on non https site, you will never able to connect. Try to enable debug of LinkedIn Integration module.
For requests from non secure sites (non https) set CURLOPT_SSL_VERIFYPEER to 0
in _linkedin_http_request() function around line 340 of linkedin.inc file
Comment #54
wweibel CreditAttribution: wweibel commentedI downloaded the entire project as posted by @Tamerzg #38, but it was still not working. A few errors being thrown and the user still not being logged in. This patch is against the current 7.x-1.x branch and also fixes the password issue addressed in #32 and # 46. The email address assigned to the created user is the LinkedIn account email.
The user will also be returned to the same page they were on after logging in, ie. the login block is being used on multiple pages, and re: login block - removed the built-in theme, css, and js, making the LinkedIn login a HTML button and below the standard login form buttons.
Comment #55
oss-usa.com CreditAttribution: oss-usa.com commentedWe made a patch https://www.drupal.org/node/2271217.
Comment #56
astenman CreditAttribution: astenman commentedHello,
I am interested in this as well. I applied the patch in #54. It seems to work, but I get a warning when I log in
Notice: Undefined index: op in linkedin_auth_form_alter() (line 57 of /var/www/clients/client43/web126/web/drupal/sites/all/modules/linkedin/linkedin_auth/linkedin_auth.module).
Kind regards,
/Anders
Comment #57
matthewmessmer CreditAttribution: matthewmessmer commentedI was unable to get patch #54 or #50 to work without errors. Some of the errors seemed to do with the work done on #54 to change the markup of the login link.
#49 was working, but I noticed that if the linkedin token was expired or revoked, the linkedin login would fail ungracefully. I tweaked the patch so that if the token is revoked, the user is prompted again to agree to login with linkedin if their uid is still attached to the linkedin id in the authmap table. If the authmap table doesn't have their linkedin id, a new user is created as normal.
I took a queue from #54 and made it so that the username is set to the email address to avoid any issue with duplicate usernames (usernames like "Joe Smith35" that #49 was creating). When trying to create a new user, it still checks if the email is already in use by another user either in their username or email field and shows an error if it is already in use prompting the user to login using their drupal username and password and then connect to linkedin in their user settings in order to avoid duplicate accounts.
This new patch should apply cleanly to the base 7.x-1.x-dev version.
Comment #58
matthewmessmer CreditAttribution: matthewmessmer commentedSome of the code that had been copied from patch #50 and #49 was causing existing drupal accounts to not be able to be linked to LinkedIn. This new patch should fix this problem.
Comment #59
Dom. CreditAttribution: Dom. as a volunteer commentedPatch#58 looks good, but just did not applied smoothly.
Here it is repacked with module folder as base. Applies on 7.x-1.x branch.
Comment #60
kscheirer#59 worked for me, thanks!
Minor notes:
scope=r_fullprofile+r_emailaddress+r_contactinfo
to justscope=r_basicprofile+r_emailaddress
since my application is not registered with linkedin and full profile is not available._linkedin_profile_vget_user_page_linkedin_fields()
requires linkedin_profile to be enabled. Could we skip this? Or add adrupal_load('module', 'linkedin_profile');
to bring that function into scope.Comment #61
TuWebO CreditAttribution: TuWebO at Metadrop commentedHello,
It worked for me too, thanks!
The only issue I've found is that the linkedin scope is hardcoded and there is no way to alter it.
I've added a drupal_alter() so other modules can change the scope and maybe set some other variables (like $_SESSION).
Do you think it is a good idea?
Comment #62
kscheirer@TuWebO thats a great improvement! Using a drupal_alter() allows users to change the scope whenever they need and doesn't require an admin interface.
Comment #63
TuWebO CreditAttribution: TuWebO at Metadrop commentedHi @kscheirer thanks for the review!
I'm already using the patch in a development site, and it looks good.
Comment #64
TuWebO CreditAttribution: TuWebO at Metadrop commentedHi,
do you think it will be good also to have a hook_linkedin_user_presave()?
This way we can control the flow right before the user is saved.
In my case is useful to see if the user is registering (with some parameters) or login in. This way I can modify the flow based on some parameters, and even do not create the user account under some circumstances.
Patch attached.
Comment #65
ArTii94 CreditAttribution: ArTii94 commented@TuWebO can You post whole working module for 7.x.1.x branch? Because when I'm applying patches most of them are getting rejected, don't know why... I got errors from installing #38 module.
Comment #66
kscheirer@ArTii94 - the patch in #38 is from 5 years ago, its not surprising it doesn't apply. Have you tried the latest patch in #64? You should be able to apply that directly.
@TuWebO - looks good!
Once this gets in, maybe it's time for a 1.0 release?
Comment #67
kscheirerComment #68
kscheirerComment #69
sarfraz742 CreditAttribution: sarfraz742 commented@TuWebO and @kscheirer #64 i tried for my fresh drupal 7 setup site but following line of code in your patch throwing error
$scope = array('r_fullprofile', 'r_emailaddress', 'r_contactinfo');
But when i replace it this line of code with following code
$scope = array('r_basicprofile', 'r_emailaddress');
Then its working good.
Can some one guide me where i am doing any mistake?
Thanks