I'm trying to login to the application using Facebook, but it always ends up with a bad request. I have read the documentation for Guzzle and Googled but no luck. Now i turn to you and hope that you can give me a hint.
This is the message that i got:
message:
"Client error response [url] https://graph.facebook.com/oauth/access_token?code=AQDRoV9AGzp-tltxQTh59UeYxfyGsThHQdc4UJ29fIh0g5iS1dKpmj2Bjjx-831WSUwVVYpIWD19crEFL0IrZPdHbl0g53bD4l1IvW0tbUTpSEzAZf-YO_zmHJFsYptwc-29DeuOuadHycPIA49O65SWQ9TDDJNSxXRmYtKYq2tbdwHczyxaupQA9IxIbaisHvHxaa3G6xURNKRiLSzKD9Qd_g4RHox-7vlYu4HZ2YljEnFAkmH7bYsKm61okTjv8JPhzQ16PXMcAwVOWpidMog7bGYzi09C7Prp5lkUUsvECIv1wwL2MNIXblDrdeW4GaU&client_id=1588368691378794&redirect_uri=http%3A%2F%2Flocalhost%3A9000&client_secret=445f1f93a81d0c24d5fbc4eb51ead669 [status code] 400 [reason phrase] Bad Request"
type: "GuzzleHttp\Exception\ClientException"
Any idea?
Solved this one. It was a trailing "/" that was missing
Related
When I upload file in a project, I get an error pop-up saying "invalid input syntax for integer: "2.01e+18".
And then when I check the concole, I get POST 400 and 404 (Not Found) errors.
POST https://api-staging.helloshop.com/v1/importer 400
POST http://localhost:3000/bags 404 (Not Found)
(I am using express.js by the way)
Is there any possible reason why both errors take place at the same time?.
You are making two requests, one for https://api-staging.helloshop.com/v1/importer, and one for http://localhost:3000/bags, and as result - recieving two errors.
Browser devtools also have a network tab where you can see which requests are you sending.
I'm trying to access Twitter API and getting Error 401. Any idea what I'm doing wrong here? OAuth URL Callback is successful and I get aouth_token and oauth_secret as well. But when I try to access the API, I'm getting 401 in Postman. Thank you in advance.
1. consumer_key
2. consumer_secret
3. oauth_token
4. oauth_token_secret
Attaching postman screenshot.
Twitter API 401 Error in Postman
I believe you are missing some of the required codes. Do you have access_token and
access_token_secret? I have 4 access codes in total, it looks to me like you only got 2.
Error 400 means that the request was invalid or cannot be otherwise served. Requests without authentication are considered invalid and will yield this response. Is there an accompanying error message explaining the error?
Check your app settings to see if you have those other codes! Hope this helps!
I'm trying to do the following using FB's official PHP SDK:
$facebook->api(
'/me/feed',
'POST',
array(
'link' => 'test',
'message' => 'test'
)
)
Unfortunately, the server (not facebook!) returns a 500 error.
The request goes through, the status gets posted, but my server returns an error.
My question is, how do I find out what's the cause of it?
500 is generally "internal server error".
If you get 500 back from your facebook api call, then it might be something wrong on their end.
Then again, your HTTP requests might be a little off, and the fb server goes "um, what?" and sends you a 500 because it can't explain the problem.
I remember a number of years ago the fb api returned mostly "unknown error" codes when something went wrong - haven't touched that api since. Hopefully you're not running into the same problem.
To really solve the problem, you will need to either:
A) capture your HTTP request and response, including the headers, compare it to a successful api call, and make changes if needed.
B) capture any exceptions thrown by the facebook SDK.
Option A will always work, but option B is perhaps quicker.
Check out:
php exceptions
EDIT:
to see what is causing a 500 error on YOUR server, look in your apache error logs.
you can also use
error_reporting(E_ALL);
to rule out any php errors.
In my case i moved the application from one server to another and the missing CURL was the bug :)
In administration mode ssh i could see following line>
PHP Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in /srv/www/smixe.com/base_facebook.php:19
In my iphone app i am using Twitter-OAuth-iPhone to post and retrieve data from Twitter. The problem is that when someone wants to post a tweet twice(maybe by mistake) i need to tell him that the tweet was already posted.
when i do this i receive a 403 error from Twitter:
request failed with error Error
Domain=HTTP Code=403 "The operation
couldn’t be completed. (HTTP error
403.)"
the message doesn't tell me that i tried to post a duplicate Tweet. The 403 code, as specified here, is used when requests are being denied due to update limits.
A solution that i thought of is to keep in my app a list of tweets that where posted (an archive) that will be checked every time a new tweet is sent. The problem with this solution is that if someone is updating his twitter status from the web or other app it will fail because the archive from my app will not be updated.
I found a comment that says that the 403 code is just for duplicate tweets, but the documentation says otherwise.
EDIT:
on https://github.com/mattgemmell/MGTwitterEngine it says that:
In these cases you'll receive a call
to requestFailed:withError: which will
include an NSError object detailing
the error. Twitter usually returns
meaningful HTTP error codes (like 404
for 'user not found', etc), and in
that case the -domain of the NSError
will be "HTTP" and the -code will be
the relevant HTTP status code. The
userInfo of the NSError will contain a
key "body" that may contain the
response body and "response" which
will contain the NSHTTPURLResponse.
This makes it really, really easy to
know what's happening with your
connections.
but the userInfo attribute of the NSError that i receive in my app is null.
The problem is that Twitter-OAuth-iPhone for 4xx responses does not return the response body.
A solution could be to modify the MGTwitterEngine to provide the full error message. An example can be found here.
I am using MGTwitterEngine for iPhone to support twitter, I am getting error(403) while posting a message second time how to handle this issue.
That is.. Let the message is "what are you doing" I am posting using [mTwitterEngine sendUpdate:"what are you doing"] for first time it is posted successfully, if i want to post the same message again it is throwing 403 error.
How to handle this?
Can i put the alert "Duplicate message" if error no 403? Is 403 error for duplicate messages only?
Added : Is it possible to check if an message is already posted in MGTwitterEngine?
The 403 error is not only for duplicate message so that you cannot throw the error message to user.
http://developer.twitter.com/pages/responses_errors
You have to find the duplicate message in your application code by keeping the last updated message.