the problem is when I reload the page the api is working but when my state changes without page reload I am getting cross origin error from this api.
the error is
I don’t know how angular works, but your request contains a custom RefreshToken header, which isn’t a whitelisted header (list of which is seen in the Access-Control-Allow-Headersresponse header of the OPTIONS request).
You need to make your CORS requests only contain the headers you specify.
The headers allowed for CORS requests by Twitch API (both kraken and helix):
We think that your angular code is reusing headers, instead of tearing down the http client and creating a new one. So your code is not sending a fresh set of headers for the request you have shown the code for.
We need to see the rest of your code, or you should be able to fix based on this