I connect the re-captcha to the site, which is built on Laravel. And when you click on "I am not a robot", and then on "registration", this error appears.
In the past, I connected the re-captcha on the framework yii2. I had no such problems with exceptions. Now I Installed captcha - Anhskohbo NoCaptcha.
The error itself looks like a notification:
Client error: POST https://www.google.com/recaptcha/api/siteverify resulted in a 400 Bad Request response:
{
"success": false,
"error-codes": [
"bad-request"
]
}
According to the Google reCAPTCHA documentation, this error is given when the request is malformed. Can you check what values are being passed to the /siteverify endpoint? The first thing that comes to mind is that the Content-Type: header for the request to Google's endpoint should be application/x-www-form-urlencoded as per this response - this is also true in my experience.
Related
When woocommerce (webhook) send a success message (200) but the body contain the below
{
"errors": {
"rest_api_unavailable": [
"The Rest API is unavailable."
]
},
"error_data": []
}
Has anyone happened this error?
Thanks in advance
I did some additional testing on the site I was experiencing this on and narrowed it down to define('ALTERNATE_WP_CRON', true) being set in wp-config.php. If you have this set, try commenting it out. In my tests, the correct payload was sent every time after commenting this constant out. Also, on a completely different site that I configured the same exact webhook/endpoint on that had no issues, as soon as I set ALTERNATE_WP_CRON to true, it started sending rest_api_unavailable for the payload. Please refer to these links for additional information and bug report:
https://github.com/woocommerce/woocommerce/pull/26878
https://github.com/woocommerce/woocommerce/issues/28363
I am using magento2 Rest API to update the quantity of product by sku and testing on postman and it gives error
Content-Type header is invalid.400 Bad Request.
I have generated the consumer key, consumer secret, Access token and Access token secret key.
Below are the setting done in postman -:
Method: PUT
URL: http://127.0.0.1/pos_mage/rest/V1/products/{sku_of_product}
Authorisation: OAuth2.0 and set the access token value
Header: Key: Content-Type and Value: application/json
Body: Key: stockItems and Value : 10
But when i am trying to run the API it gives me error
{
"message": "Content-Type header is invalid."
}
400 Bad Request.
I am testing on my localhost.
I have checked many tutorial but still not success-:
Magento 2 - REST API PUT product
Why "Invalid Content Type"
Magento 2 Updating Stock via Rest API
In the case of a REST API with a JSON payload, 400 error code are typically used to indicate that the JSON is invalid in some way according to the API specification for the service .
Check whether the request contain a valid JSON format or try the following :
ContentType = "application/json" and Accept = "Application/json"
I'm recently tried to use webhook to get update from telegram. my program work correctly whit getUpdates().
but when i set webhook i got
"Wrong response from the webhook: 400 Bad Request"
error when try to check status of webhook by getWebhookInfo method.
here is my code:
$telegram->commandsHandler(true)
when is used below code in getUpdates mod every thing was fine.
$telegram->commandsHandler(false)
And is should say i use https and my ssl is ok.
This is answer of getWebhookInfo to me.
{
"ok": true,
"result": {
"url": "https://telbit.ir/api/bot/<token>",
"has_custom_certificate": false,
"pending_update_count": 13,
"last_error_date": 1476344420,
"last_error_message": "Wrong response from the webhook: 400 Bad Request"
}
}
I found my answer
every things was ok. the error happens because of my framework.
I tried to create a webhook for a task in Asana but the only response I'm getting is this:
{
"errors": [
{
"message": "Could not complete activation handshake with target URL. Please ensure that the receiving server is accepting connections and supports SSL",
"help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
}
]
}
(Status: 400 Bad Request)
I am sending a POST Request via Postman to https://app.asana.com/api/1.0/webhooks with following content:
{
"data":
{
"resource": 123456789012345,
"target": "https://example.com/asana.php"
}
}
The asana.php looks something like this:
$headers = getallheaders();
$secret_token = $headers['X-Hook-Secret'];
header('X-Hook-Secret: ' . $secret_token);
What am I doing wrong? Am I missing something?
According to the Asana API Reference (https://asana.com/developers/api-reference/webhooks),
The target must respond with a 200 OK and a matching X-Hook-Secret header to confirm that this webhook subscription is indeed expected.
When you send the header, do you know what response code is being sent? Perhaps you might want to have a look at the $http_response_code argument in http://php.net/manual/en/function.header.php
When I do a GET request for a url on my laravel web app, I do the following in my controller to retrieve a custom header:
Request::header('customheader');
This value is always blank, though the header is clearly visible in Chrome Developer Tools in the Request Headers
While troubleshooting I tried using a standard header: Connection
Looking at the request headers, I expected the following:
Request::header('Connection') == "keep-alive"
What is super weird is that this instead returned "close" aka, the value of Connection in the Response Headers. This explains why my custom header is showing up empty (it is not in the response, but the request).
So what gives? The Laravel docs clearly state that this is the way to retreive REQUEST headers.
http://laravel.com/docs/4.2/requests#request-information
Any soltuions to get what I want?
edit: $_SERVER["HTTP_HEADER_NAME"] as proposed in https://stackoverflow.com/a/541450/1800023 gives me the same results. The values are those from the RESPONSE headers.