Hi guys, Thanks for your replies. I had indeed checked the headers through the Developer Tools in Chrome, which showed a HTTP-403. Played around with Plunkr, but couldn't get it to work, due to complexities in my router and as we're currently in development state, I don't have an SSL secured endpoint. Plunkr doesn't like a plain endpoint and requires the endpoint to be HTTPS. For now I am checking on the reponse.status being -1, instead of an HTTP status code. I currently don't have the time to investigate (or prepare tests), but I will most definitely come back to this later. Thanks again for replying!
Cheers, Patrick On Wednesday, 13 January 2016 12:53:20 UTC, Nicolás Mancilla wrote: > > Hello! > > Have You checked the response headers instead of the angular code (google > chrome dev tools -> network tab)? > > You should force a status 401 from the service when the token has expired > (in my case, I throw an exception, catch it at a higher level - > Global.asax, for example - and return 401 status). > > I use this Google Chrome extension > <https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US&utm_source=ARC> > > to test API calls/responses. > > El miércoles, 13 de enero de 2016, 5:42:39 (UTC-3), Patrick Plaatje > escribió: >> >> Hi, >> >> I am trying to intercept some of the HTTP calls my app is making to a >> remote service. To be able to use this service, I will need to send a JWT >> in the header. Sometimes, the token/secret used for the JWT has expired >> however and it will be up to my app to intercept the response, and if the >> status code is a 4xx, request a new token. >> >> The interceptor I'm using does actually catch the response error, but >> when I log the response object, the response.status contains -1, instead of >> my expected 401. Any thoughts? Let me know if you need more info, or a code >> snippet. >> >> Thanks, >> Patrick >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
