3

This is the opposite of this post. I want to send an angular $http request, but not include cookies. I can't figure out how to do this though. I tried setting

$httpProvider.defaults.withCredentials = false;

in config.js, but this didn't work. Is there another way?

Community
  • 1
  • 1
Nick
  • 1,864
  • 5
  • 27
  • 49
  • 1
    You might be solving the wrong problem here. Why don't you want the cookies sent? – Joseph Apr 21 '17 at 18:57
  • It's an attempt to find a bug with an API I'm using. Authorization using Token isn't working when it should be, and my suspicion is the API is reading the cookies first and using those as auth instead of my token. – Nick Apr 21 '17 at 19:04
  • @Nick - Why don't you just make the call from the browser dev tools using fetch (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) rather than mess with your app code just to debug an API issue? – jbrown Apr 21 '17 at 20:11
  • Because the problem is only occurring my chrome extension that I'm working on that uses Angular. Is there really no way to disable cookies with angular $http? – Nick Apr 21 '17 at 20:17
  • None of this makes much sense. Especially considering that if request is cross origin `withCredentials` default is false already and no cookies would be sent – charlietfl Apr 21 '17 at 22:10
  • I'm not sure either. I managed to finally fix this by deleting all cookies related to the API's domain first using chrome.cookies.remove. – Nick Apr 21 '17 at 22:17

0 Answers0