Stuck at OAuth2 Facebook connector

Now the Hmmmm error message disappears, but the first error keeps refreshing over and over again when I hit ok

I have this turned on on my SSL settings.

"Force HTTPS

This will force SSL connections for all your visitors by enabling our load balancers to redirect all your users to use HTTPS. Please note, this will only work if you have an SSL certificate on this package and changes will take 30 minutes to take effect.

Disable Forced HTTPS"

Should I disable it?

I think it is good to force HTTPS, but I don’t think that it will solve your problem.

Agreed @patrick but will be interested to see if they are related, if so I will take it up with the service’s tech support

The support team has responsed:

“Could I ask for some more details regarding this, please?
What steps are you taking to receive this error so that we can try and replicate the issue by testing this ourselves?
We would need any information that is related to this issue if you could and try to explain exactly what you are seeing or provide screenshots if you can”

Now this can be a bit difficult for me to explain as it is a visual coding platform. What steps they would need to take to make this manually? Can you please help?

if it were me i would send them a link to this forum post to show whats going on, as well as sending them a link to your server connect script that they can run in their own browser.

@Hyperbytes, I am going to test out a few things on this today and will let you know the outcome, if I do not come right then maybe we can get the provider involved.

Hi!

I’ve set a test user to my fb app, to login with Facebook account with permission. Everything worked for a test user with a link (https://liveworkoutpass.com/dmxConnect/api/Security/fblogin.php)

BUT still, I’m not able to get this damn thing work…

Now, here are the latest error messages when clicking a link

A server error occured, to see the error enable the DEBUG flag.

In the console, the error (see screenshot)…

tested different server. here’s the next error msg:

{“error”:{“message”:“An active access token must be used to query information about the current user.”,“type”:“OAuthException”,“code”:2500,“fbtrace_id”:“AAJIYUNesSM8M0R3TJTnNac”}}

Did you set the Authorization in your API call?

I had a similar issue at one point, all i did was go into the facebook app settings and tell it to reset the token, then test right after the reset

Yes for both…

This:

{“fb_auth”:{“access_token”:“EAAFNDRp8NX0BADMhroCjmI3DqYOxZCcCbtEoyovTlTc29ZBBQrt1VqyFeMufIqA69t9v1lZCnR2QrLL9VJCPcDQX8LWob7jcUlZCCdHqZCsDgBKH0PFNvW4HbXORkCPSxtxvpshCHBugDppiv22WIwQw3W6J541zzsXAm6P1iBAZDZD”,“token_type”:“bearer”,“expires_in”:5179833},“api1”:{“status”:200,“headers”:{“0”:“HTTP/2 200”,“etag”:"“ee8882293611f4469f4c2d8052cd116eeeb9aa3b”",“x-app-usage”:"{“call_count”:3,“total_cputime”:0,“total_time”:1}",“content-type”:“application/json”,“facebook-api-version”:“v6.0”,“strict-transport-security”:“max-age=15552000; preload”,“pragma”:“no-cache”,“x-fb-rev”:“1002026217”,“access-control-allow-origin”:"*",“cache-control”:“private, no-cache, no-store, must-revalidate”,“x-fb-trace-id”:“GHukxn8ZsB7”,“x-fb-request-id”:“AKRngEJzfXDD70ygDxWoZYo”,“expires”:“Sat, 01 Jan 2000 00:00:00 GMT”,“x-fb-debug”:“Qla/u1quqAP3nZi8EFlhedchBjTD83kwqKerryU1W6ZqK+DB/DB8d5inff+hMYYk3sZkohVdn11jKxMx5N033w==”,“content-length”:“64”,“date”:[“Wed, 22 Apr 2020 15:39:00 GMT”,“Wed, 22 Apr 2020 15:39:00 GMT”],“alt-svc”:“h3-27=”:443"; ma=3600"},“data”:{“email":"petri.olsson@gmail.com”,“id”:“10158231425848637”}}}

Well that looks like you finally got a good response to the API, great news, so finally you should be able to continue with the rest of the procedure, make sure to copy the data portion of the response to the schema area in Wappler, although Teo’s tutorial does explain that, so you could probably just follow on from that point.

Ok. That’s great news. Is this how it should look like?

Just to let you know that I’m now testing different server (Fastcomet). This is NOT the same hosting as we were discussed earlier. So it must be something wrong with their server configuration.

1 Like

Yes, that looks perfect, that is a good point to continue from, just remember it gives you an access token for 1 hour, so if things start going wrong while working, just test and if you do not get a response like your screenshot, then refresh the token in order to continue working on it.

With this new server I’m testing, I was able to pass the fb login process without any problems… :face_with_raised_eyebrow:

Let’s see how the support team can handle their issue…

1 Like

If you are using 20i servers as I suspect you are you can also enable error messages temporarily under the PHP configuration options.

image

Like this

Our platform team have provided an example of how this code needs to be updated:

The check they’re doing is using $_SERVER[‘SERVER_PORT’] which does always return 80 here due to the load balancers.

With regards to the below function they would instead need to set the port based on the https variable rather than using $_SERVER[‘SERVER_PORT’];

Or a simple/crude solution would be to use $port = 443;

protected function getRedirectUri() {
$https = isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] == ‘on’;
$port = $_SERVER[‘SERVER_PORT’];

    $url = 'http';
    $url .= $https ? 's' : '';
    $url .= '://';
    $url .= $_SERVER['SERVER_NAME'];
    $url .= ($https && $port == '443') || (!$https && $port == '80') ? '' : ':' . $port;
    $url .= parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);

    return $url;
}

IT WORKS IT WORKS IT WORKS!!!

What I did?

I deleted the $_SERVER[‘SERVER_PORT’]; and replaced with 443;

FINALLYYYY!!! :grin: :beer: :beer:

That is great news, glad you finally got this working, amazing how many issues a simple port can cause, days upon days of trouble.
I wonder if the solution is something @patrick could use in the Wappler application itself or if we would need to use a workaround like this whenever we are using a hosting provider that incorporates a similar load balancing setup.