(failed)net::ERR_CERT_AUTHORITY_INVALID when using fetch api in Chrome extension service worker - google-chrome-extension

We are migrating our chrome extension from Manifest V2 to V3. In this process we removed JQuery AJAX requests and started using fetch API in the background page for sending REST API requests to the server. When sending the requests, the first 2 to 3 requests will get a response but after that the requests are failing. It is throwing (failed)net::ERR_CERT_COMMON_NAME_INVALID error.
The API requests works fine when using the Jquery AJAX calls.
API calls in the network tab
Details about the server :
The server is installed in my machine only. I am accessing the server through localhost. When we access the server for the first time in a browser a warning page will be shown. We have to click proceed to access the website. Normally the Jquery AJAX requests works fine once we click the proceed option.
Server warning page
I tried giving different header options in the fetch API, but the result was still same.
How do I resolve this fetch API error ?

Related

Some API's are failing with TestCafe framework due to which data is not rendering on UI

I am using testcafe with typescript to automate the CRM application .At one point when i click on a button it is redirecting me to a new page where we have multiple API calls which renders data on UI .One API is failing everytime with automation whereas it is passing with manual.I connected with one of the developer and he confirm that data is being returned via the AJAX call. However the TestCafe test-framework proxy called hammerhead.js is throwing an exception with the message :
ERR_EMPTY_RESPONSE. I have tried everything i.e timeout , ajax timeout , hard wait but didn't get anything fruitful.
Network response
Data is not populating underUpdates from portal whereas it is working fine with rest other section as mentioned in picture

How to logging in to asp.net website using node.js

I want to login and get my transcript from my school's website using nodejs. I checked the network flow while logging in. Website uses asp.net and there is __VIEWSTATE __VIEWSTATEGENERATOR and __EVENTVALIDATION parameters passed to the form-data. I think this values are randomly generated on the browser. How can i do the same thing on node.js? However it works when I run it by copying request from chrome devtools and pasting it in postman. But why it doesn't work in node?

Is there a way to request an internal API of a public website from Node fetch?

I am trying to scrape dynamic websites and was using Puppeteer with Node.js before I realized i can just fetch the website's API directly and not have to render stuff that I don't need. By looking in the "Network" tab of Chrome's developer tools I could find the exact endpoints that returns the data I need. It works for most of the sites I am trying to scrape, but for some, especially POST requests, the API returns a "403: Forbidden" error code.
The API returns a success if I do a fetch-request directly from the Chrome console. But as soon as I try from a different tab, Postman, or Node using node-fetch I get "403: Forbidden".
I have tried copying the exact headers that are sent naturally from the website, and I have tried explicitly setting the "origin" and "referer" headers to the website's address but to no avail.
Is this simply a security measure that is impossible to breach or is there a way to trick the API into thinking that the request is coming from their own website?

API call work on nodejs but not on angular / client side js

I'm trying to access STREAK Api using angular. When i'm sending the request to Streak i'm getting a CORS Policy error but when trying to access the same request using Node.js i'm getting the response.
So my question is, why is that happening? both the client and the server are hosted on localhost
For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts.
This doesn't have anything to do with angular or any other javascript framework.
You can read more about CORS here

Mixed Content issue with Heroku and Soundcloud API

I'm trying to deploy a test app to Heroku that involves downloading tracks from the Soundcloud API. The core functionality works fine locally, but runs into the mixed-content error when attempting to download tracks with an xmlhttprequest to the Soundcloud API due to Heroku's ssl layer.
I've searched the other mixed content questions and the general response is to add the 's' to the request or eliminate the http(s) altogether. My request url for the SC API is already https, but it looks like SC is using a redirect based on the error messages in the console. Am I just stuck?
The only workaround I can think of would be to request from the server and then pipe the response to the client... which would be fine for my app's functionality, but seems like a hack. Any ideas? Thanks!

Resources