alixandru / q2a-open-login

Question2Answer Open Login plugin
62 stars 44 forks source link

not working. #14

Closed tanaydin closed 10 years ago

tanaydin commented 10 years ago

hi there,

I'm using q2a at my sites that working on subdomains like...

http://yemek.neyapmali.org or http://bitcoin.neyapmali.org

even I enable facebook and google there is no link for registering or login... I'm using q2a 1.6.2 and also I tried development branch...

alixandru commented 10 years ago

Can you remove the Facebook plugin which came with Q2A installation? Simply remove the Facebook folder from qa-plugin directory and then try again. Let me know how it goes. În data de 29.12.2013 03:37, "tanaydin sirin" notifications@github.com a scris:

hi there,

I'm using q2a at my sites that working on subdomains like...

http://yemek.neyapmali.org or http://bitcoin.neyapmali.org

even I enable facebook and google there is no link for registering or login...

— Reply to this email directly or view it on GitHubhttps://github.com/alixandru/q2a-open-login/issues/14 .

tanaydin commented 10 years ago

hi, I tried both, master and development branch... still nothing on header... css in header starts with "/* Open Login buttons /", ends with "/ End of Open Login buttons */" but nothing on page...

alixandru commented 10 years ago

I'm sorry, it's not clear to me whether you deleted the stock Facebook plugin that came with the Q2A installation originally. In qa-plugin directory, where you placed the q2a-open-login folder, there might be a folder named "facebook-login". Please delete that folder (facebook-login) and test again.

tanaydin commented 10 years ago

I deleted original folder, and tried with both master and development branch of your plugin.

alixandru commented 10 years ago

Ok, I see. Well, this is strange. Did all database initialization go OK after the plugin was installed? What value does option open_login_ok from qa_options table have? I suspect the plugin has not completed the initial setup. I will try to install it on a clean q2a instance and go over all the installation steps. Perhaps this way I can figure out what's going on. Let me know if you manage to get it working.

tanaydin commented 10 years ago

hi I think I found problem...

it gives permission error problem while writing 'providers.php'

it works when I put file there.

tootomthumb commented 10 years ago

Hi, I was reading this trail trying to solve my own problems with Open_login. Basically I get all the buttons (for networksI have details or Gmail/Yahoo) but when someone tries to login using them it gives an unspecified error=0.

Feel free to play around on the site at http://poqery.com. Right now it is a test site.

I have already deleted the facebook-login plugin, and the database initialisation seemed to go well. At least I have the oemail column in the two tables.

I also checked my "open_login_ok" in the qa-options table and it is =1

Another thing I noticed is that neither Q2A or your instructions talk about file/directory permissions. At first I wasnt even getting up the login icons but I changed the directory/files to 755 and that seemed to help. Are there other things I need to watch for?

This is a LAMP stack installation whereas I had the whole thing installed and running just fine on an Win IIS installation. So I dont think I'm doing anything obviously wrong.

Nonetheless I assume my installation is messed up. What do you suggest I do?

Thanks in advance for any help!

alixandru commented 10 years ago

@tanaydin Right, the code needs write access to that file. This is not mentioned in the read-me but I will fix that in the next version.

@tootomthumb I can't think of anything else right now. From what I could see, the plugin is not even initiating the login process with the external service. This makes me believe it might be related to configuration or something similar. Another thing which might cause this is the style of the links you are using in Q2A (i.e. poqery.com/index.php/users instead of poqery.com/users). I remember testing the plugin with all possible link configurations in Q2A, but perhaps there's something I have missed. I will look into this and get back to you.

MaxjTechno commented 10 years ago

@tootomthumb : Just to know, which version are you using ? However to troubleshoot your issue I would start with putting a simple "print" exactly here : https://github.com/alixandru/q2a-open-login/blob/master/qa-open-login.php#L116 that is at line 116, immediatly inside the catch and before all the other instructions inside the catch, e.g. : error_log(print_r('****\ qa-open-login.php::check_login EXCEPTION ! : '.$e, TRUE));

After that try again the login and check the output inside your error log.

MaxjTechno commented 10 years ago

@tootomthumb

another thing to check is that your CURL is enabled. Open your php.ini file and check that you have this line uncommented :

[PHP_CURL] extension=php_curl.dll

That is check that you do not have :

[PHP_CURL] ;extension=php_curl.dll

If it's commented, uncomment it and restart your webserver

tootomthumb commented 10 years ago

Firstly thanks to both of you guys for such prompt responses! It made me feel bad for going to bed last night and not being as responsive in kind! :)

@alixandru On my defunct Win IIS installation I had it running using the third URL structure listed "/?qa=123/why-do-birds-sing" On this LAMP installation I have it on the second URL structure "/index.php/123/why-do-birds-sing".

To test, I changed my LAMP installation to the third structure but there was no improvement and I changed it back again.

@MaxjTechno I'm using Open Login v2.1.0 and Q2A 1.6.2

Just for background, I'm normally a lazy Win GUI user so Linux is quite a learning curve for me. I'm also doing this test site on Amazon EC2, so again excuse any newbie questions unrelated to this issue. What is the best way to edit the file? Should I use Pico (or some other SSH text editor) or should I set up an FTP server and get proper access? In this case I just used Pico to speed the process...

Unfortunately Pico doesnt have a line number indicator and I'm not a PHP programmer! So my final code looks like this:

                    } catch(Exception $e) {

                            error_log(print_r('****** qa-open-login.php::check_login EXCEPTION ! : '.$e, TRUE));

                            // not really interested in the error message - for now
                            // however, in case we have errors 6 or 7, then we have to call logout to clean everything up
                            if($e->getCode() == 6 || $e->getCode() == 7) {

Is that correct? What a learning curve! I didnt know what error log you were referring to, so I installed Webmin (after a google search on error logs) and then checked them all! I found this in the Apache Error log:

[Fri Jan 03 13:31:31.577734 2014] [:error] [pid 22146] [client 86.154.199.8:51059] ****\ qa-open-login.php::check_login EXCEPTION ! : exception 'Exception' with message 'Hybridauth Library needs the CURL PHP extension.' in /var/www/question2answer/qa-plugin/q2a-open-login-master/Hybrid/Auth.php:107\nStack trace:\n#0 /var/www/question2answer/qa-plugin/q2a-open-login-master/Hybrid/Auth.php(39): Hybrid_Auth::initialize(Array)\n#1 /var/www/question2answer/qa-plugin/q2a-open-login-master/qa-open-login.php(90): Hybrid_Auth->__construct(Array)\n#2 /var/www/question2answer/qa-include/qa-page.php(106): qa_open_login->check_login()\n#3 /var/www/question2answer/qa-include/qa-page.php(788): qa_check_login_modules()\n#4 /var/www/question2answer/qa-include/qa-index.php(175): require('/var/www/questi...')\n#5 /var/www/question2answer/index.php(31): require('/var/www/questi...')\n#6 {main}, referer: http://poqery.com/?provider=Google&code=0

So it sounds like your second message is a winner...I hope. Now to find the php.ini file! Again, google to the rescue and it is in /etc/php5/cli

But when I checked there was no entry whatsoever for [PHP_CURL]. So not knowing how this file really works, I just added it in the bottom of the php.ini file and restarted Apache.

Unfortunately I'm still getting the same error, so either I have the wrong PHP.ini file or perhaps it doesnt recognise my addition to the file.

BTW I used Amazon EC2 Ubuntu 13.0 and the standard command of: sudo tasksel

to install my LAMP stack...in other words it was all a default installation.

I know we are now probably going down the level of teaching me how to use Linux/PHP but I hope these efforts will help other users in similar situations!

MaxjTechno commented 10 years ago

Your issue is due to the fact that the CURL is not installed. I've commented my curl installation on my test environment and I have the same behavior that I see on your website.

To check which php.ini file you must modify to have the CURL enabled, put this php : https://www.dropbox.com/s/invranujpkr60lm/phpinfo.php

under your webserver docroot

and invoke it (e.g. http://poqery.com/phpinfo.php )

On the result page search for the "Loaded Configuration File" value. On the same line you'll be able to see which php.ini file you are using. In my case I can see this value :

/etc/php5/apache2/php.ini

alixandru commented 10 years ago

Indeed, CURL is a requirement.

If you are using a standard Ubuntu 13.0 distribution then most likely the CURL extension for PHP is not yet installed. The phpinfo file can confirm this if no information about CURL appear on that page.

You can install CURL by running:

apt-get install php5-curl

This will also install libcurl3 and curl packages, if not already installed. After this, you will see a new file in /etc/php5/apache2/conf.d called curl.ini, which basically will have only one line:

extension=curl.so

Make sure this line is not commented with a semicolon (;). After that you can check again the phpinfo file to confirm it shows information about CURL.

Let us know if the plugin is working fine after this.

PS: Thanks, @MaxjTechno for your valuable input on this :)

tootomthumb commented 10 years ago

@MaxjTechno

LOL, so that shows you how google doesn't tell you everything, I was modifying the wrong php.ini file!

You can see the new page as you have instructed and my php.ini file is in the same place as yours.

Unfortunately the php.ini file was an exact copy of the incorrect one I modified. There is no entry for [PHP_CURL], so I just added it to the bottom of the file. In interestingly there is an entry for [curl] which I assume is related and by chance is at the bottom of the file as well. So the bottom of my file now looks like:

; Useful for internal debugging only. ;opcache.protect_memory=0

[curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an ; absolute path. ;curl.cainfo =

[PHP_CURL] extension=php_curl.dll

; Local Variables: ; tab-width: 4 ; End:

Unfortunately that didn't seem to do the trick, I'm still getting the same error! Obviously this seems a bit strange to me as I'm running PHP5.5.3 which I assume is up to date (it is an Amazon EC2 image after all!) but doesnt have the right stuff!

I have just seen a posting by @alixandru coming in as I am writing this, so I will check that out as well.

tootomthumb commented 10 years ago

@alixandru I ran the install and now have the required files...and it works!!!

I know I'm ranting (not even preaching) to the choir, but I have to say this has been a fantastic experience for a Windows guy to see the power of Linux/Open Source and most importantly the contributors of those projects.

Thank you @MaxjTechno and thank you @alixandru for all of your help!

MaxjTechno commented 10 years ago

@tootomthumb the instructions I gave you were for a windows installation (dll), not Ubuntu glad to know now it works !

@alixandru since I know you are working for me ;-) ;-) ;-) it's a great pleasure if I can help you sometimes too !!! :-)

alixandru commented 10 years ago

@tootomthumb Great! I'm glad we could help. Do open a new ticket here if you run into any issue with the plugin. May I also suggest you try the new version of the plugin code (3.0.0, available in the development tree here: https://github.com/alixandru/q2a-open-login/tree/development). It has some improvements and a somehow more logical approach of treating duplicate accounts of the same user from different providers.

I am going to keep this issue open until I make some changes to the code and readme file, to make sure the requirements (like CURL) are clearly stated to all people installing this plugin for the first time.

@MaxjTechno That's the Open Source spirit :)

tootomthumb commented 10 years ago

@alixandru Is there some development package I need to download?

To install the original package I used: sudo wget --no-check-certificate https://github.com/alixandru/q2a-open-login/archive/master.zip sudo unzip master.zip sudo rm master.zip

Then changed the permissions (they were root and not full r/w) using: sudo chown -R www-data /var/www/question2answer/qa-plugin sudo chgrp -R www-data /var/www/question2answer/qa-plugin sudo chmod -R 755 /var/www/question2answer/qa-plugin

I've probably used some sub-optimal way to install the package originally, so I'm open to any new techniques you want to point out!

Also it is worth mentioning that when I try the Yahoo login it directs me to a new page where I can see that I'm already logged into Yahoo but then says to "Sign In to poqery.com with your Yahoo ID" I re-enter my password and then I'm in a BT-Yahoo homepage and not Poqery. Also when I go back to Poqery I'm not logged in. Should I start a new ticket on this one?

alixandru commented 10 years ago

The way you installed it is OK. In order to get the code from the development branch you just need to use a different download URL: https://github.com/alixandru/q2a-open-login/archive/development.zip (if you use a custom CSS theme you need to manually update it when updating to v3).

As for the Yahoo login issue, that's strange. It seems it's not redirecting you back to your site, for some reason. Have you tried while you are logged out of Yahoo? I will try to create an account through Yahoo on your site, if that's OK for you and try to troubleshoot. You can create a new ticket to have the issues tracked separately.

Thanks!

tootomthumb commented 10 years ago

Of course you are welcome to try and create a login! I can set your account to super-user and would even give you access to the server itself if that is what you need.

For instance I can set you up with a Super user account on Q2A and a user account on PHPMyAdmin if you would like.

I tried logging out of BT-Yahoo first of all and it did finally allow me to log in after going through 2-3 pages of screens, not nearly as clean as Facebook or Google.

I deleted the original plugin, downloaded the new one, relaunched Apache and went in to configure it. It immediately requested another re-initialisation of the database which seemed to work and seemed to do some different things from the first package.

It's allowing me to login via Facebook, Yahoo and Google but it's now starting to act a bit strange....

For instance I had already created an account with my personal email address, the same one shared by my Google account. I now have my original account still there but also a new account set up by Google but WITHOUT AN EMAIL!

I'm thinking it might be better to strip out all of the user accounts except the original Admin account and start logging in again from different angles. If that seems sensible to you, can you tell me what is the best way to delete the accounts and get to a good starting position?

alixandru commented 10 years ago

I would really like to see 2 tables from your database: qa_users and qa_users_logins. There are indeed some strange things happening: I was able to log in with my yahoo id, but for some reason, instead of creating a new account, my id was linked to an existing user of your site (the one with the handle "MI... TA... 1"). After unlinking the id, I logged in with yahoo again and I finally got a new user account (alexl) on the site.

But then I logged in with another yahoo login and the same thing happened: the new id got associated with the existing account alexl. Same with another (3rd) yahoo id. So somehow, no matter what yahoo id I use, it always links it to the last account it created. At least this is what it looks like. You can try it for yourself, with a new yahoo id - you will probably be logged in with alexl account. Apparently this is only happening for Yahoo. Gmail seems to work for me, tested with 2 gmail accounts.

I could not reproduce this on my test environments, so this is why I would like to see what data you have in your tables, especially qa_users_logins. You can send me only some columns: userid, source and identifier to preserve privacy. Send it to my gmail address - see alexl2 user on the site.

tootomthumb commented 10 years ago

I'll do better than that....I'll send you direct access to the PHPMyAdmin so you can peruse it at your leisure. Heading over to you right now!

tootomthumb commented 10 years ago

I sent the login and I can also confirm that when I attempted to login using Yahoo I was in Alexl's account.

alixandru commented 10 years ago

Issue #15 has been created to track the Yahoo problem. This issue will be closed now.

BootStrapDJ commented 10 years ago

Hi ALIXANDRU. We are using your "open-login" plugin for our Q2A site "www.bootstrapdj.com". We were using your previous version of "open-login" plugin in that "google login" was not working but other login like FaceBook, Twitter were working properly.

After you have upgraded plugin , we have deleted our old plugin from server and the "oemail" column from tables "qa_users" and "qa_user_logins". Then we have uploaded new plugin but at this time the database initialization is not taking place, Also the social buttons are not showing in our site.

Next what to do so that the plugin will do database initialization. Please help.

Regards

alixandru commented 10 years ago

You need to run this statement on your database:

UPDATE qa_options SET content='0' WHERE title = 'open_login_ok'

Usually, the plugin is setting this option to a value different than 0 after initialization to prevent useless checks and to improve performance. By setting this option to 0 manually, you are forcing the reinitialization of the plugin.

You might need to logout/close browsers in order to start a new session (without cached data) after changing this value, if nothing happens.

BootStrapDJ commented 10 years ago

Hi ALIXANDRU, Thanks for your help, DataBase initialization asked via Admin panel and all the respective values like "open_login_ok" is showing 1 now and "oemail" column from tables "qa_users" and "qa_user_logins" are reflecting now. And we have also started new session( cached data cleared ) , Still Social buttons are not showing.

Why the social plugin css is not being called and shown.

alixandru commented 10 years ago

You need to make sure the file providers.php from the plugin directory is write-accessible, so the plugin can write some data to that file.

alixandru commented 10 years ago

If there's no such file there, create one and make sure it has the right permissions.

BootStrapDJ commented 10 years ago

Thanks ALIXANDRU, With "providers.php" now the social buttons are showing, but as before twitter and facebook are working fine however google plus is still giving error. Following are the details

Error message from google,while putting my email id and password


  1. That’s an error.

Error: redirect_uri_mismatch

The redirect URI in the request: http://www.bootstrapdj.com/?hauth.done=Google did not match a registered redirect URI


Here are the details that i've created my account on "https://code.google.com/apis/console/" for OAuth My details: Redirect URIs http://www.bootstrapdj.com/oauth2callback Javascript Origins http://www.bootstrapdj.com

I've not pasted my Client ID and Client Secret which i copied and pasted in open-login plugin. However it is showing Client ID, Email Address, Client Secret, Redirect URIS, JavaScript Origins. So if i'm using my email-id which is actually my user account for this app creation then i'm able to login but if i'm using any other email-id then it is giving above error. Please give your valuable opinion.

alixandru commented 10 years ago

Your Redirect URI, as defined in the Google App Console is incorrect. Use http://www.bootstrapdj.com/?hauth.done=Google

BootStrapDJ commented 10 years ago

I believe either i'm creating my credential in wrong place or i've to do some thing with this email-id field, because whenever i'm signing with my email-id which is being used to create credentials it is allowing but when i'm testing it with other mail-ids it is failing.

BootStrapDJ commented 10 years ago

Thanx Sir its working!! Thanks a Ton!!

alixandru commented 10 years ago

Good! Glad I could help!

BootStrapDJ commented 10 years ago

Alas!!

BootStrapDJ commented 10 years ago

I've tested with other mail id but its lost, no user created and return to my webpage... www.bootstrapdj.com

alixandru commented 10 years ago

before clicking on the google button, did you logout by going to http://www.bootstrapdj.com/logout ?

BootStrapDJ commented 10 years ago

testing with facebook and twitter if with them user are creating or not.

BootStrapDJ commented 10 years ago

Hi Alixandru,

Tested with Facebook and Twitter, with both users are getting created and we can logout and again re-login but with google its not allowing to login, however its showing one page where we have to accept but then its returning back to site without creating any user on the portal.

alixandru commented 10 years ago

I don't have a Google Plus account so I cannot test right now. I will get one next week when I will also have some more free time to debug this. I will keep you updated with what I find.

alixandru commented 10 years ago

Is this issue still occurring, @BootStrapDJ ?

alixandru commented 10 years ago

Closing this for now. If there are still issues, please open a new ticket.