Laravel API throws FileNotFoundException when accessed through an android app - filenotfoundexception

I'm working on an API using Laravel 5.2. I have disabled the csrf token by commenting \App\Http\Middleware\VerifyCsrfToken::class in kernel.php. If I access my API with postman everything works like charm but when using an android app I get FileNotFoundException. Please help. I can post the code and other details if you want. Thanks in advance.

Sorry It was an issue on the android side not on Laravel. It is resolved now.
The issue was that I was setting the HTTP CODES myself in Laravel. So the problem was If i set a code in range 4XX( like 404), android will consider it as an error and show fileNotFoundException and neglect the stream in the connection. So changing getInputStream to getErrorStream resolved the problem. getErrorStream reads the stream even if the response code is some kind of error like 404,422 ,etc. I hope the explanation is sufficient.

Related

How do I capture csrf / xsrf token/cookie in Postman with Interceptor from Spring Boot with Spring Security?

`
First of all I am sorry about the format of this question. I tried to format the code but I only got error messages.
I have been trying for quite some time now, searching StackOverflow and all over the webb. I am following a Tutorial on Spring Security etc...and specifically Basic Authentication where I am supposed to capture csrf-token in Postman with Enterceptor. I have searched many threads here on StackOverflow and tried many things but I have not been able to solve it yet.
I have been reading about problems with security and SameSite= Lax and so on but I am not very confident in what to do and do where...
Since the "websecurityconfigureradapter" is deprecated, I tried to write my own SecurityConfig-file...
maybe there is something wrong with that?
I would very much appreciate any help.`
have been trying the following in my config-file:
http.csrf(csrf -> csr
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()));
with the following script in Postman test tab in the request:
var xsrfCookie = postman.getResponseCookie("XSRF-TOKEN");
pm.environment.set("xsrf-token", decodeURIComponent(pm.cookies.get("XSRF-TOKEN")));
with Header: X-XSRF {{xsrf-token}}
I have tried to install some kind of SSL-certificate in Postman, but I am not quite sure
how that works.
I have also read about how to set Flags in Google Chrome to control SameSite in some way but I have a version of Chrome (109) where I canĀ“t set flags anymore.
And I have read somewhere that there is some problem with SameSite...and localhost?

AEM as a Cloud Service + CIF Addon - /api/graphql not working on Publish SDK

One quick question. As of last week I had completely setup the AEM SDK with the Venia store front with all the components working. When I move the setup the AEM publish SDK, I am encountering one issue.
The /api/graphql is throwing 403 errors which means no frontend commerce operation is happening on the storefront.
I tried adding the /api/graphql to the CSRF filter's exclude list and even removed the POST method from there.
After this I still 403 on GET request of /api/graphql and the following on POST request.
I am I missing some setting?
Note: on the sling servlet resolver config, I have added the /api/graphql but there is no change.
There is a query very similar to this on the groups but there is no response. So thought of raising it here.
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-cif-magento-on-publish...
Please let me know if I am missing something.
Issue solved.
I introduced a var called COMMERCE in the global vars to solve the problem, since the vhost file refers to it.
I could have done it slightly better but I guess i was lazy :)
Please refer to this link for details:
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-cif-magento-on-publish/m-p/442185#M31799

Quickblox.sdk GetBaseSession() method throws "nonce is required" error

I have used quickblox chat sdk in my old xamarin.forms project. I know that quickblox is not supporting xamarin now, but old sdk was working fine till now, but from last week I am getting this error.
Code:
var baseSesionResult = await Provider.QbProvider.GetBaseSession();
When I am calling QbProvider.GetBaseSession() it throws below error:
CONTENT: {"errors":{"base":["nonce is required"]}}
I have tried different methods available in sdk but none is working. Any one know how to fix this error?
This is Nikolay from QuickBlox support.
Please add "" symbols around nonce and timestamp values and check if the issue is resolved.
The same information is mentioned in our documentation: https://docs.quickblox.com/reference/authentication#create-session
We released a patch for authentication that improves validation according to our documentation.
Hence, the issue is caused by incorrect implementation in the application that is why the server has started showing errors for submitted requests.

Could not load file or assembly 'System.Net.Http.Formatting, Version=5.1.0.0'

I'm facing this issue while trying to call my bot via directline:
As you can see on the image below, my webapi bot project is using the version 5.2.4.0, but according to the log error, the Microsoft.Bot.Conector is trying to use an old version of it ?
Does anybody have a clue on how can I solve it ?
Adding a binding redirection as #Eric suggested worked fine.

POST via $.ajax (with PhoneGap 2.6 and Zepto.js) on Android Woes

I am currently working on a PhoneGap app which is required to POST to a server (running Django). Unfortunately, we are not receiving the anticipated response when we perform this action: We get a 200 message with no data, rather than a 401 (unauthorized) with a json object.
Our javascript code is similar to: this code
The server-side python looks a bit like: this code
Any ideas?
Thank you!
I can not help you with your specific problem, but I can tell you that you will never get a 401 code back.
PhoneGap applications have an issue with it: they return code '0' instead of '401' for some reason. It is on their official JIRA:
PhoneGap JIRA
So whatever you find for solution for your issue, you will just get a new problem.

Resources