ElkArte Community

Project Support => Support => Topic started by: fremzy on March 15, 2020, 07:50:20 pm

Title: Need Help with Social Login and Register
Post by: fremzy on March 15, 2020, 07:50:20 pm
Hi,

Can someone please help me with this? To be upfront, I'm a complete noob, so some of what's fuzzy to me may be very clear to everyone else. Please indulge me.

I'm trying to connect Elkarte to Facebook so members who have Facebook don't have to login separately to Elkarte once logged into Facebook. I've downloaded and uploaded the "Social Login and Register" add-on package, followed the instructions to set it up on Facebook (created app, added oAuth URL e.t.c..) but when I go to my forum page, I don't see an option to login using Facebook, or anything like that. What am I doing wrong?  :(

http://addons.elkarte.net/feature/External-Auth.html

P.S:  I posted on the thread for this add-on, but it was last active over 12 months ago, so not sure anyone will see/respond to it.
Title: Re: Need Help with Social Login and Register
Post by: emanuele on March 17, 2020, 12:58:21 pm
Hi @fremzy I assume you already followed the path described in the screenshots like:
https://raw.githubusercontent.com/Spuds/Elk_Social_Login/master/sample_images/sample1.png
to enable first the addon and later enable the FB registration and add the key, right?
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 17, 2020, 10:57:38 pm
Quote from: emanuele – Hi @fremzy I assume you already followed the path described in the screenshots like:
https://raw.githubusercontent.com/Spuds/Elk_Social_Login/master/sample_images/sample1.png
to enable first the addon and later enable the FB registration and add the key, right?

Hi Emanuele,

Thanks so much for responding. I don't have settings for oAuth Providers as shown in that image. Here's a screenshot of my settings page. Perhaps I've neglected to do something?
Title: Re: Need Help with Social Login and Register
Post by: emanuele on March 18, 2020, 12:59:50 pm
Can you please check if you have "Extauth.integration.php" in the sources directory?
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 18, 2020, 03:11:14 pm
Quote from: emanuele – Can you please check if you have "Extauth.integration.php" in the sources directory?

I don't. 😳
Title: Re: Need Help with Social Login and Register
Post by: emanuele on March 19, 2020, 09:02:53 am
That may explain quite a bit of things. :D
Most likely the install failed for some reason. The first that comes to my mind are file permissions.
I'd say try check the file permissions, they should usually be 644 for files and 655 for folders (if I remember correctly).
Ownership may be a little more tricky, but check also that and if it matches with the apache server. Otherwise the permissions should be 755 and 777.
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 19, 2020, 02:34:55 pm
Quote from: emanuele – That may explain quite a bit of things. :D
Most likely the install failed for some reason. The first that comes to my mind are file permissions.
I'd say try check the file permissions, they should usually be 644 for files and 655 for folders (if I remember correctly).
Ownership may be a little more tricky, but check also that and if it matches with the apache server. Otherwise the permissions should be 755 and 777.

Thanks again for your assistance. I checked permissions - 644 for files and 755 for folders. I didn't get any error message during installation, so I don't know what could have gone wrong.
That "Extauth.integration.php" file you mentioned, can I just find a copy of it and pop it in the 'Sources' folder? Would that work?
Title: Re: Need Help with Social Login and Register
Post by: radu81 on March 19, 2020, 05:56:52 pm
Quote from: fremzy – I checked permissions - 644 for files and 755 for folders.
that should be fine
Quote from: fremzy – That "Extauth.integration.php" file you mentioned, can I just find a copy of it and pop it in the 'Sources' folder? Would that work?
I am not using this add-on, but you can download the add-on and unzip it on your pc, then copy the file sources/Extauth.integration.php to sources folder. I also suggest to open with a text editor the file package-info.xml and check if the other files were copied.

have a look at this piece of code
Code: [Select]
		<require-dir name="sources/ext" destination="SOURCEDIR" />
<require-file name="sources/Extauth.controller.php" destination="CONTROLLERDIR" />
<require-file name="sources/ExtauthAdmin.controller.php" destination="ADMINDIR" />
<require-file name="sources/Extauth.subs.php" destination="SUBSDIR" />
<require-file name="sources/Extauth.integration.php" destination="SOURCEDIR" />
<require-file name="themes/default/Extauth.template.php" destination="THEMEDIR" />
<require-file name="themes/default/1.1/Extauth.css" destination="THEMEDIR/css" />
<require-file name="themes/default/english/Extauth.english.php" destination="LANGUAGEDIR/english" />
 where:
SOURCEDIR = /sources
CONTROLLERDIR  =  /sources/controllers
SUBSDIR = /sources/subs
THEMEDIR = /themes/default
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 19, 2020, 08:47:33 pm
Quote from: radu81 –
Quote from: fremzy – I checked permissions - 644 for files and 755 for folders.
that should be fine
Quote from: fremzy – That "Extauth.integration.php" file you mentioned, can I just find a copy of it and pop it in the 'Sources' folder? Would that work?
I am not using this add-on, but you can download the add-on and unzip it on your pc, then copy the file sources/Extauth.integration.php to sources folder. I also suggest to open with a text editor the file package-info.xml and check if the other files were copied.

have a look at this piece of code
Code: [Select]
		<require-dir name="sources/ext" destination="SOURCEDIR" />
<require-file name="sources/Extauth.controller.php" destination="CONTROLLERDIR" />
<require-file name="sources/ExtauthAdmin.controller.php" destination="ADMINDIR" />
<require-file name="sources/Extauth.subs.php" destination="SUBSDIR" />
<require-file name="sources/Extauth.integration.php" destination="SOURCEDIR" />
<require-file name="themes/default/Extauth.template.php" destination="THEMEDIR" />
<require-file name="themes/default/1.1/Extauth.css" destination="THEMEDIR/css" />
<require-file name="themes/default/english/Extauth.english.php" destination="LANGUAGEDIR/english" />
where:
SOURCEDIR = /sources
CONTROLLERDIR  =  /sources/controllers
SUBSDIR = /sources/subs
THEMEDIR = /themes/default


Thank you, radu81!

I unzipped the add-on on my system as advised, then grabbed the "sources/Extauth.integration.php" file and copied it to the server. Then I compared all the files and folders from the unzipped add-on on my system with what exists on the server. I noticed that MOST of the files and folders in the unzipped file were not on the server. So, I manually copied them to the server in the appropriate locations.

Then, I used the code you gave and made the changes to package-info.xml (which by the way did not exist on the server before). Then I refreshed my Elkarte settings page and still had the same thing (only change was a warning that I hadn't deleted the install file which I just uploaded).

What am I doing wrong?
Title: Re: Need Help with Social Login and Register
Post by: radu81 on March 19, 2020, 09:17:43 pm
You don't need to edit the file, just open it and check if all the files were correctly copied

eg:   <require-file name="sources/Extauth.subs.php" destination="SUBSDIR" />
check if in  /sources/subs you have a file called Extauth.subs.php
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 19, 2020, 10:30:28 pm
Quote from: radu81 – You don't need to edit the file, just open it and check if all the files were correctly copied

eg:   <require-file name="sources/Extauth.subs.php" destination="SUBSDIR" />
check if in  /sources/subs you have a file called Extauth.subs.php

Okay, I just checked and moved the files that were missing to those locations. Still no luck. That "oAuth Providers" tab is still missing.
Title: Re: Need Help with Social Login and Register
Post by: emanuele on March 20, 2020, 03:55:46 am
Because then there is to run add_remove_hooks.php (put it in the root of the forum and point the browser to it).
Though, this leaves the issue that any future addon fremzy will try to install will still very likely have the very same issue. Oh well, we will see what time comes.
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 20, 2020, 04:38:08 am
Quote from: emanuele – Because then there is to run add_remove_hooks.php (put it in the root of the forum and point the browser to it).
Though, this leaves the issue that any future addon fremzy will try to install will still very likely have the very same issue. Oh well, we will see what time comes.

I did this and got a message saying "Congratulations, you have successfully... "

But I still don't have that 'oAuth Providers" tab 😢
Title: Re: Need Help with Social Login and Register
Post by: emanuele on March 21, 2020, 12:48:16 pm
hmm...
I haven't tried it, I guess I have to cleanup an install and try the addon to see. From the code I don't see any obvious error.
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 21, 2020, 01:41:11 pm
Quote from: emanuele – hmm...
I haven't tried it, I guess I have to cleanup an install and try the addon to see. From the code I don't see any obvious error.

I'd appreciate the help, if you can?
Title: Re: Need Help with Social Login and Register
Post by: emanuele on March 22, 2020, 09:09:36 am
I did test it and it works just fine installing it from the package manager.

Try running also install.php the same way you did with the addon file (please remember to remove these files from the server when you have done).
Then, can you check:

I swear I had another thing in mind, though I can't remember it. Oh well.
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 22, 2020, 04:00:55 pm
Hi Emanuele,

Thanks for hanging in there with me. So I just went ahead and tried to reinstall it all over. This time, I opted to install through URL instead of uploading the package and it worked (at least, so far far, it looks like it did)! THANK YOU!!!

You know, I'm thinking as I'm writing right now that maybe it even worked before but I just didn't complete the process. I did upload the package manually (first time), BUT I never went into the packages area to actually install the package. Not sure if I was meant to do that, but I didn't. And thinking through it now, that might have been the problem I was having.

Again, thanks so much to you and Radu for not leaving me here screaming into an echo chamber.  :D
Title: Re: Need Help with Social Login and Register
Post by: radu81 on March 22, 2020, 04:48:57 pm
Glad you solved, elkarte add-ons are working in this way, you need to upload, then install. Some add-ons have a direct link to continue with install after uploading the package, some don't so you have to go to Packages and install.

Maybe this is a point that could be improved in Elkarte 2.0. What do you think about it @emanuele@Spuds‍ ?
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 23, 2020, 02:32:48 pm
Sorry, sadly I'm back...  :(

So I've done everything as detailed in the instructions. I'm having problems getting this to work with the two platforms I'm trying to add.

For Facebook, I get the error in the screenshot: "URL Blocked. This redirect failed...."

In the case of Google, I don't get any errors, but it doesn't appear to work. My presumption is that if you're already logged into Google (e.g. Gmail), when you go to my Elkarte forum, you should be automatically logged in. Am I wrong?

Please help....  :'(
Title: Re: Need Help with Social Login and Register
Post by: emanuele on March 26, 2020, 04:10:23 pm
Hi, sorry for the late reply.

I can only guess that you have to find a place in Facebook in which you can add the URL of your forum...
Unfortunately I don't have a FB account, so not sure how it works...
Title: Re: Need Help with Social Login and Register
Post by: fremzy on March 28, 2020, 01:50:53 am
Thanks. I just got tired and left it for the day. I'll try again tomorrow. Maybe I'll start all over and repeat the steps.  :(
Title: Re: Need Help with Social Login and Register
Post by: radu81 on March 28, 2020, 02:28:19 am
you can google for that error, there are a lot of results, have a look at this, the first link I found
https://www.facebook.com/help/community/question/?id=1278521772201326
https://stackoverflow.com/questions/35509771/url-blocked-this-redirect-failed-because-the-redirect-uri-is-not-whitelisted
Title: Re: Need Help with Social Login and Register
Post by: fremzy on April 15, 2020, 02:03:23 am
Thanks for your help. I hadn't been able to touch this for a while because things have been crazy over here. But I gave it another go tonight and I made some progress. The link that actually helped me is https://stackoverflow.com/questions/35509771/url-blocked-this-redirect-failed-because-the-redirect-uri-is-not-whitelisted (in case someone else has this problem and they go through this thread).

So right now, I've been able to add all the credentials without getting errors and I'm able to go into existing accounts and "connect" them with the respective social media accounts. However, a few things still remain unclear/not working:

1. When I click on the button to register (new account) using the social media buttons I configured (Facebook and Google), I'm just taken back to the main login screen. From the instructions, I should be taken to a registration screen of sorts for those social media.
2. I'm still somewhat unclear on how this is supposed to work. My thinking is that if it's working properly (and I've already connected the accounts), when I'm logged in on Google (Gmail) for instance, if I navigate to my elkarte forum within the same browser, I should be automatically connected. At most, I should just have to click on the corresponding button to login without having to provide login credentials. Am I correct in this assumption? If so, it's not working for me right now.

Any and all insight would be appreciated.

Thanks so much!