Strange facebook API error? - php

Local and preproduction versions of my website have same configs and same source code. For some reason preproduction version unable to communicate with Facebook API. When I'm trying to login using Facebook I'm getting such strange error:
Google translates the error message like this:
"You can not load the URL: field is not a URL is included in this application areas. To download this URL, please add all domains and sub-domains for your application to the "application domains" field in the application settings."
I have tried to add my domain to the list, but it didn't help.
The truth is, I'm stuck and I would be grateful for any hint what to do with the error.
P.S. Also I have no idea why the error message is in Arabic - Server from Germany and has en_US.utf8 locale.
Update Settings Basic (domain name changed)

Finally I found the issue. I've used cascade of reverse proxies (nginx), which modified $_SERVER['SERVER_PORT']. The modification leaded to inconsistency between generated redirect_uri and the value was specified in app settings in Facebook developer console.

Related

redirect uri error with oauth2

I am a newbie in php, but I am a long time coder. I am trying to get the google drive api for php working with the example files provided, but I am getting a redirect error with the following information in the message:
redirect_uri=http://jppp.com:8080/interface/googletest/simplefileupload.php
In every answer I have seen the problem is that the redirect uri in the code does not mach that on the google console, but in my case they appear identical. Here is the line of code (from the example) I cant use localhost because the lamp server is hosted on docker, and google won't let you use an IP address for the uri. I ended up changing my hosts file for jppp.com to the docker container.
$redirect_uri = 'http://jppp.com:8080/interface/googletest/simplefileupload.php';
and here is the relevant section of my google console api credentials. I have also waited more than half an hour in case google was slow in updating and tried it in a different browser.
picture of google api credential screen
Can anyone see a difference between the code and the console? What else can I try to get this working?
Thanks,
Derek
Apart from having this URL added as an allowed redirect_uri, you need to configure the domain itself in the Google Console.
When you add it & verify ownership, then you can play with it. The section can be found here:
https://console.developers.google.com/apis/credentials/domainverification

Triggering Azure WebJobs API over Basic Auth from external PHP app?

As per the title - I'm trying to trigger an Azure Website "triggered" WebJob from our custom PHP deployment application hosted external to Azure websites.
Thanks to what I believe is Active Directory, I'm able to navigate the /api URLs in my browser and get a JSON output without having to reauthenticate. For example, /api/triggeredwebjobs outputs the triggered WebJob information (that I've set up inside Azure Portal) in my browser.
I've gotten as far in my PHP app as sending a POST request and it is successfully authenticating using basic auth, but every single /api URL that I set in my PHP app returns:
"No route registered for '/api/triggeredwebjobs/{webjobname}'"
where {webjobname} is my custom name for the web job, hidden for privacy of the client. Every URL returns this, but if I navigate in my browser, I only get that error if I navigate to a URL that doesn't exist, such as /api/blahblahblah.
I've set up a deployment user which is what it's using to authenticate... I've even logged in to https://{azuresite}.scm.azurewebsites.net/basicauth using the deployment user and successfully gotten output from each /api page in my browser.
If it helps, I'm using Httpful.phar to handle the HTTP requests.
Thank you very much for taking the time to read and possibly assist.
A colleague helped me get to the bottom of this - the documentation was out of date. I have opened an issue on the Kudu Github Repo to get them to review this:
https://github.com/projectkudu/kudu/issues/1466
To solve the issue for future readers of this question, the correct URL to use within the requester app is:
https://{yoursite}.scm.azurewebsites.net/jobs/triggered/{jobname}/run
Good luck!

Shopify API using PHP, redirect_uri and app url must have matching hosts of myshopify.com?

I'm trying to use the php shopify api library created by
cmcdonaldca at https://github.com/cmcdonaldca/ohShopify.php and
I am getting this error:
The redirect_uri and application url must have matching hosts
This occurs after I type in the shop name of [myshopname].myshopify.com and
the error appears on a page with this url:
https://[myshopname].myshopify.com/admin/oauth/authorize?client_id=[myclientid]&scope=Customer&redirect_uri=http%3A%2F%2Flocalhost%2Ftest%2FshopifyAPITest2.php
I'm doing this development locally so my host is localhost, is that really
the issue? The first time I tried entering a shop name I got to the
shopify page asking me to login, but then when I tried it again later it is
giving me the error. Is there some session variable that was set initially
that is causing the error? It doesn't look like it based on the error, but
that's what the behavior suggests.
Please help me understand how to address this issue. If it really means
the api script needs to be hosted at myshopify.com (the host for
[myshopname].myshopify.com) how would I put a php script there?
Thank you
The error you're receiving is telling you that the domain of the application URL you entered for the app in the Partners dashboard differs from the one you're providing with your OAuth request.
Make sure it's listed as localhost and the error should go away.
Also, make sure you have set your API key and shared secret correctly in config/application.rb

App on Facebook

I'm trying to run the example.php file that comes with the facebook sdk. I do have a hosting server that runs php, and also changed the ID's to the corresponding one on my app. Here is the message i'm getting:
This webpage is not available
The webpage at https://filipeximenes.com/facebook/ might be temporarily down or it may have moved permanently to a new web address.
Error 501 (net::ERR_INSECURE_RESPONSE): Unknown error.
i'm pointing the canvas to this adress: http://filipeximenes.com/facebook/
Thanks.
Based on your description, I think that this is your problem:
Do you have a valid security certificate on the hosting server? I ran into that problem recently when deploying an FB app. Since October, you have to have a valid cert even in sandbox mode for the FB app to run properly. If you don't have one it causes weird problems.
Just a thought that I hope helps.
One other thing to do from a debugging perspective is to take a look at the actual app running on your hosting server without viewing it via FB. If you get the same error message there, you know that it has nothing to do with the FB SDK.
Thanks!
Matt

Zend_Uri_Http generates "inet_pton(): Unrecognized address" error

In our application, the backend is accessed via Zend_XmlRpc. In the backend, I'm using Zend_Http_Client together with Zend_Http_Client_Adapter_Curl to connect to another web service over HTTPS.
During unit tests, everything works as expected and the remote service is accessible. But when the frontend connects via Zend_XmlRpc to the backend and causes the backend to do the exact same thing like the unit tests do, I get the following error:
inet_pton(): Unrecognized address test.example.com#0 (url changed)
This is caused by Zend_Validate_Ip->isValid('test.example.com').
The only difference I can spot is the additional frontend-backend-connection which is also using Zend components for communicating. Everything else is the same.
Anybody any idea?
Looks like it might be a resolver issue in the server and zf isn't catching it beforehand. It's getting a hostname where it should be getting an IP address (obviously), and it can't convert a string to a binary IP address
It was an error in Zend_Validate that was fixed with release 1.9.

Categories