srpurdy / SharpEdgeCMS

Content Management System
http://www.sharpedgecms.com/
MIT License
18 stars 4 forks source link

Twitter and Facebook Auth NOT working on Sharpedge CMS V 3.42.76 #37

Closed ebonylegg closed 9 years ago

ebonylegg commented 9 years ago

After clicking the connect with twitter, it takes you to twitter fine, after entering the login information, it says redirecting and then it fails at the call back to the original site. I am not sure what the twitter call back bage is supposed to be, But I used "../user/auth" as call back

Same thing happens with facebook, it goes to facebook fine, after entering facebook credentials, it seems fine, but on redirecting to the website is when the error occurs. For facebook I am also using the same call back link. See attached photos for pictures of the errors Twitter connect error below: twitter-connect-error

Facebook connect error below (removed for security reasons) - I've taken note of the error.

Or could it be that I am not using the correct call back url?

can you kindly help? Thanks

Legg

srpurdy commented 9 years ago

Hi I'm looking into it. Seems like something has changed at least on facebooks end.. However for facebook you shouldn't need any call back URL since this is sent with the request and handled when it redirects you back. The error your getting is facebook isn't sending back the email address. Which is why it is throwing an error, because SharpEdge cannot create the user account without the email address.. For twitter /auth/twitter_callback

srpurdy commented 9 years ago

In the case of facebook. Make sure your app in facebook is set as live. From the top nav bar select: Apps >> Your App Name >> Status & Review You need to set the toggle switch to Yes (If you are not able to do that you must submit your app, and fill in all details the submission form asks for) Once that is completed you should be able to set it to Yes. Otherwise facebook will not give out certain information such as email address.

Also I'm assuming you edited the file in /sharpedge/config/facebook_login.php to include your app and secret?

I will get back to you on twitter, While I do have twitter code in there. I believe twitter does not provide any information that is useful. So this is really a hidden feature in sharpedge that is not really functional. But I will double check that. I was originally going to include this but twitter decided that providing an email address is not part of their API. Which makes twitter auth completely useless. For reference https://twittercommunity.com/t/how-to-get-email-from-twitter-user-using-oauthtokens/558

Although I am open to suggestions. I'm not sure what can be achieved without being able to extract information needed. Unless I build a prompt for asking the user for their email address in which case I can look at making this an actual feature in the CMS.

ebonylegg commented 9 years ago

For Twitter, the correct call back URL seems to be "http://website.com/en/auth/twitter" Twitter refused to accept the url "http://website.com/en/auth/twitter_callback" as NOT Correct. I noticed that everything is fine on the twitter end. The problem is with the website sharpedge CMS end. Because on the twitter end, twitter added the website and gave permission to use account correctly. Here is the URL link after successful twitter validation

http://website.com/en/auth/twitter_callback?oauth_token=WpZ0RgAAAAAAhER-AAABTz7eboY&oauth_verifier=mfjIXaidoIlEskJkpjeuvo7bImpMK6K8

but the same error like before is still displayed below:

Array ( [oauth_token] => 3291648108-TlpfzUjhUyhV6VOb3WDedDwK3MTKDHdzVMIURTv [oauth_token_secret] => xzi76yHYB9ZYKyUENO70j1wr9aZkADds37thdydTE8z7f [user_id] => 3291648108 [screen_name] => twittername [x_auth_expires] => 0 )

ebonylegg commented 9 years ago

And Yes for the facebook, everything is OK from facebook's end. The app is live and the app does validate account and shows that permission has been granted to use the facebook login. the problem arises when re-directing back to the website.

ebonylegg commented 9 years ago

UPDATE! TWITTER NOW PROVIDES EMAILS TO APPS. They started doing so since Jan/2015 but had been quite about it. Here are the links and documentation on how to implement or use xauth to get emails. https://dev.twitter.com/rest/reference/get/account/verify_credentials http://docs.fabric.io/android/twitter/request-user-email-address.html

I hope that information can help...

srpurdy commented 9 years ago

Hi Ebony,

Your right facebook changes some things in API 2.4 and thats why it is not returning information that it is suppose to. I will put in a fix for this shortly.

ebonylegg commented 9 years ago

Thanks lots I will wait.

ebonylegg commented 9 years ago

Could this be a typo error preventing twitter? on line 192 in file: /sharpedge/modules/users/controllers/auth.php it says "redirect(base_url('/twitter/auth'));" should it not be "//redirect(base_url('/auth/twitter'));

srpurdy commented 9 years ago

Well as I already mentioned the twitter login code is not an official feature. So chances are it won't be working. I can open up a feature request for this if you like. I will have an update soon in regards to the facebook login. However you are right in that it would be /auth/twitter

Thanks for the information in regards to the twitter api. I will take a look into it. :)

srpurdy commented 9 years ago

facebook login is fixed is 3.42.80