Axios api call twise with 204 no content - laravel

i'm getting error while i'm calling simple post api and it throws 422 with 204. and in my code i used try and catch. it every time going to catch. i'm using laravel as a backend and vue.js 3 as a frontend. for api calling i'm using axios.
204 preflight error
I checked solutions in google but they all asking for sanctumn/csrf-cookie. but i'm not using sanctum in my current flow.

Related

API call returns a response in postman but gives me 403 in browser

ajax call
postman url
console error
Postman returns a response, but browser gives me 403. I have attached my postman request, my ajax call as well as the browser error. Any advice is helpful
You need to pass credentials. follow this link for more information.
I ran into this issue as well. While cedric is right, the Authorization header needs to be specified, another issue can cause this as well. Postman does not include an Origin header in its requests (see: https://stackoverflow.com/a/68380707/1029688). This could cause it to ignore CORS errors that you would normally encounter when making web requests from a browser.

API server block request from GuzzleHttp

I have 2 servers which are API server and Client server ....
Both server using Google Cloud server and I use Laravel framework to develop my system...
So, currently the problem is, it return 403 error when calling API (to API server) using GuzzleHttp (from Client Server).....
But after I change the user agent to curl/7.65.3, suddenly it is working fine...
But I want to know why??? Is there any other solution without changing the user-agent???
Thanks
What is your use method? If GET you can refer to:
GET Requests That Include a Body
If a viewer GET request includes a body, CloudFront returns an HTTP status code 403 (Forbidden) to the viewer.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html

Laravel 5 get response header

I need to get the Http response Link Header from a Shopify orders http request. Unfortunately, the application is still using Laravel 5.1 and not the latest version.
(I believe) The call is being made using Custom HTTP Requests with some docs on this page:
https://laravel.com/docs/5.1/testing
This is the call being made that returns order data but no other info.
$this->shopifyApiCreds->call($params)
This returns a response variable, but I do not know how to return any headers from this response.
Thanks!

django-wkhtmltopdf with AJAX requests will get 403 Forbidden

Description
I want to generate a PDF file from Django view, so I'm using django-wkhtmltopdf app, the app is working but my template (that is used in the view) has many AJAX requests using jQuery. Views that requested by AJAX requests are protected by csrf token.
Issue
All AJAX requests are getting 403 Forbidden response because of CSRF verification failed.
Trial
I tried django-cors-headers and still getting the same responses.

Laravel api returns 401(guzzle http client and php curl)

I am implementing laravel api with 'api_token' method.
API working fine in POSTMAN REST CLIENT and core php curl request.
But i tried to get response in laravel app using Guzzle Http client and native curl method. Both request returns 401 unauthenticated. i used same api_token which i was used to test in postman rest client. Any idea?
Note: Its not a CORS problem.
Its happen because of app cache.
Just cache:clear and config:cache will resolve this problem!

Resources