Sessions are Missing With Facebook PHP Sdk (Nginx Php-Fpm) - facebook

I have 2 different servers and one has login problem with facebook. After days and hours debugging , I realized that I can get only one session from facebook session array.
Server with Php-Fpm and Nginx has also memcached installed on server. But never record sessions on memcached.
PS: I realized that my facebook login doesn't work properly, when we installed ssl on our server. Till 19th of june, my facebook app summary doesn't show any active users.
I already asked a question before debugging my server, so this question different than this question but you could have some clues there.
Codeigniter getuser() returns 0 after facebook dialog
Array
(
[fb_318641601624810_state] => a44e40cd3f78e7bd3ff39308aebf32ef
)
Hosting from hostgator
Array
(
[69a781bf56f6d6bfec49fd65c890f879_fb_136649313157374_state] => 6df72b81b5be574ea5b263ef97225b3b
[fb_319000531588917_code] => AQCAGxOs9dtrS9ppFC6NhLOiWc1moSLPMl0JewkEYYrBWKP7PvL9hv_LuV6vv3pmBzmawpQ8J5aj3hl9ZEiHEWlm5hw9EroLH_JOVXv3YvJcZfdzknQ1QscPnEQr8DgYbFOH-_S193p7Fv2PNd0U3IR1zE1Jb9YOjHorzWjW5iyrGzu2mF3g7Nmg2ONEibmlNQUKUwljcUC7lyzxeC6qjHMEkYqDm3-f8xWx7OjVtQQzFoRZzXgTOislJ7-JQ0LHnu4kZjT46Q0K64Bvz040ab2hwoRjyiUIgWwFpctuYMtqYxxRnt2nJXNRCn8oigF_LB0
[fb_319000531588917_access_token] => CAAEiIRleVzUBACpazeUMcTvULMpPZADu5QwiPpAU0RUmHGIFNkWsvfQKPCvBpC3ZA8C1IfuALn0YVyobGffp52o1ZBJbpiPSx66ZBO6MGoEZBhRkLjsjIZASRxvNyLhj5mqddxbcREZCznuYyeVLZAa97IiHA9ZC3arkJZBThtuYylLym8jG8zdTtaHIoG0oKKeb8ZD
[fb_319000531588917_user_id] => 608666757
)
I start to compare php.ini confs but there is no luck, is it possible have problem like this? Or am I debugging wrong? Because I have been working on this for 2-3 days and I'm nearly getting crazy.
My testing page both of them are different apps for testing. These are not Codeigniter based testing pages they are simple php sdk's, I wanted to know that if the problem is with Codeigniter.
So the problem is my nginx site never get return access_token in session array.
You could compare my phpinfo files from here.
Compare Phpinfo files
I will be really happy if you could help me on debugging this problem, now nobody could sign up or login from my facebook login.
Just only one scenario works, if user already granted my app in past. User has to click login again after access token error.

After alot debugging and session handler tests. I realized that the main problem is PHP 5.5 still keeps state session. And query_string state code couldn't match state codes. So always CSRF problem on PHP 5.5.
I will install new server with php 5.4. Will keep you about this bug.

Related

Cant Use Facebook API on AppEngine

So, I have this grade project where I have to do a mashup and deploy it on AppEngine. So, everything is fine, and I even got it working some months ago, but when I deployed the project again after doing some changes and updating the facebook api, it no longer works.
Thing is, it does works on localhost. The error only occurs when deployed. It's only a normal publish post POST.
So, here's the error:
The URL was blocked: Redirection has failed because the URI is not incluided in the list of OAuth authorised of the application client. Check that the OAuth access of both client and web are active and add all the domains of your apps as OAuth redirection URI
This was translated from spanish so it might not be totally accurate.
So, it seems easy, but I don't really know if the proble is that I have to do something in the configuration of appengine control panel (most likely), in the configuration of the facebook api control panel or if it's something in the project code. I've checked everywhere and have the faint memory of solving this several months ago, but I can't anymore.
Thanks!
For Facebook login, you need to tell Facebook the URI of the page that the login will start from. If you change the URI, then the login process will break. You can set the URI from this page:
https://developers.facebook.com/apps/1234567890/fb-login/
Except that you need your app id in there instead of 1234567890. You can get there from here:
https://developers.facebook.com/apps

Has anyone actually got ASP.NET MVC 5 Identity Facebook logins to work out of the box? (loginInfo always returns null)

Using Visual Studio 2013 Update 5, I have created a boilerplate MVC 5 application with Individual User Accounts auth option selected, and I have been trying to implement social logins using the template code, but have been unsuccessful.
I have ensured all NuGet packages are up to date, and the code is using MVC 5.2.3; Owin 3.0.1; AspNet.Identity 2.0.0.
I can get everything working fine, including authenticator apps using OtpSharp, but the Facebook login is just not working whatever I try.
I have created the Facebook App, set all the relevant options on that and set the AppId and AppSecret in my Startup.Auth.cs file.
When I try to login with Facebook, the MVC site redirects me to Facebook, which prompts me with the auth screen for the app. I click OK and accept this then I am redirected back to the MVC app. If I check the authorised apps under my Facebook account, my app is listed and shows that it has granted permission to the app to retrieve email address.
The callback works fine but when it hits ExternalLoginCallback and in particular:
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync()
loginInfo always returns null.
Looking at the Request it shows an error of access_denied:
https://localhost:44301/Account/ExternalLoginCallback?ReturnUrl=%2Fmanage&error=access_denied
I have read pretty much every blog post and SO question on this error and whilst most of them are helpful, most are also out of date and not relevant.
It would seem that something is missing from the templated project, or something has changed elsewhere as no matter which tutorial I read, and options I set, the result is the same.
I have tried this internally on a dev machine running IIS Express and externally on a hosted machine running IIS 7.5 too and the results are the same.
I've even decompiled the Microsoft.Owin.Security.Facebook library to see where that particular section of the querystring is set to no help.
If I had any hair I'd have pulled it all out by now.
I'll take any suggestions. Can anyone help?
Facebook loves to make things difficult. Access_denied sounds like they are blocking you on purpose. Check your developer dashboard and the accounts authorized to test your app while its in development mode. The email permission is approved by default, so that isn't your issue.
Make sure the account you are testing with is added here:
If that doesnt solve it, make sure you have the correct app domains (testing and live) listed in the domain section here:
I had the exact same issue. No matter what I did the facebook would show the login, get permissions and then return back to the Login page instead of the Email confirmation page.
Using Fiddler Facebook would invoke "http://localhost:1234/signin-facebook&code=SOME_SECRET_CODE_HERE", and then my application's controller would invoke "http://localhost:1234/ExternalLoginCallback?error=access_denied". I was sure Facebook is refusing the access. It was only after implementing a Facebook Javascript SDK Sample, I realised I could successfully login and also view FB scopes!
My Dev environment
MVC 5 application
Visual Studio 2013 Community edition Update 5
Microsoft.OWIN v2.2.1
Microsoft.OWIN.Security.Facebook v3.0.1
Finally I found a YouTube Video by ProCoder which mentioned to put the correct path in the Valid OAuth redirect URIs as http://localhost:1234/signin-facebook and it worked. If you haven't already added, you will need to add Facebook Login product to your Facebook app.
I also set App Domain to localhost and Site URL to http://localhost:1234/
I have added 127.0.0.1 and MY.EXTERNAL.PUBLIC.IP to the Server IP Whitelist Under Security in the Advanced Settings option of the Facebook app.
All these settings I replicated in a new MVC 5 application and it worked like a charm.
update the package Owin.Security.Facebook 3.0.1 to 3.1.0
It works for me

Facebook Application Error: https://www.facebook.com/4oh4.php

I am new in developing my facebook application. I know php, HTML. I have a application in my server: http://www.example.com/app_name
with only one file written in php i,e index.php
I filled all the requisite as instructed by facebook documentation for canvas URL and all. Now when i am trying to access this http://apps.facebook.com/app_name
I get this error: The Page you requested was not found.
https://www.facebook.com/4oh4.php
Can anyone please help me????
There is a currently open bug report in Facebook's bug tracker about this issue: https://developers.facebook.com/bugs/325223977546904
It could take a while for your app to propagate to all FB servers so you may just have to wait a little. Are you logged in as the administrator to the app? If you have it set to private then you will be redirected to the 404 page if you are not an admin or tester.
I had the same issue which seemed to be transitory. About ten minutes later the site started working again. Facebook.... Sigh.

Infinite Reload With Rotating State Param in Facebook Application

Infinite Reload With Rotating State Param in my facebook web app, this problem occur suddenly and suddenly all fb app on my server stop working
Page is refreshing again and again and not able to open ,
script work fine in other serverbut fails to work in this , is there any server config to handle facebook app.
You can chk issue at Link - gomandi.com/visit/
State Token is Refreshing again and again in all website hosted in my server , Looks like some Server confiG. issue is there . Can anyone help me with this.as i am my server support team unable to find this issue why my server fails to connect with fb server or viceversa.
SAME APP WORK IN OTHER SERVER !!
Based upon the comments on the question above, what you need to do is to create a brand new app for the different domain names. So you can have specific URLs for each domain specified in each of the app's app settings. So if there are three domains, then I'd recommend three apps configured correctly to point to each of those three domains.

php-sdk sometimes doesn't connect to facebook but rarely and for no apparent reason

I have been using php-sdk to connect to facebook for a while and I never had any problems, but now, I can't connect from my computer.
But other people can connect from their computers, I asked a lot of people to confirm and they all said it worked fine..
..can facebook put a ban on my ip or something ?
It's not a ban, it happens when the auth cookie get's messed up on your local machine. It either just hangs when you try log in or continuously redirects.
My suggestion would be to create a page, include the PHP FB SDK make the following call:
$facebook->destroySession();
That should get it working again. (well, it does for me)