What I could do is implement an httpInterceptor which will handle response errors with status code 0. As soon as I get such a response I could trigger a $window.location.reload. This would again trigger the proxy and he would redirect us to the login page.
On Wed, Jan 29, 2014 at 3:22 PM, Michael Hunziker < [email protected]> wrote: > Hi Sander! > > But how can I "resolve" a 302? All I get back after the AJAX call is a > response with status code 0... > > Here's again what happens exactly: > > 1. User logs in to our app via SSO proxy. > 2. User logs out in another application via SSO proxy, but our app is > still open in another browser window. > 3. User comes back to our app and clicks a button which will do a REST > call. > 4. Call arrives at proxy. Proxy immediately returns a 302 redirect to the > login-page since the user is not logged in anymore. > 5. The response back in the browser looks like this: > > Console Error: > XMLHttpRequest cannot load '.../ABC/LOGIN'. No > 'Access-Control-Allow-Origin' header is present on the requested resource. > Origin '.../XYZ' is therefore not allowed access. > > The response object in AngularJS looks like this: > Object {data: "", status: 0, headers: function, config: Object} > > What I would expect is status code 302 and even the redirect location, so > that I could handle the redirect to the login-page in Angular myself... > > Do you see my problem? > > Michael > > > > > > > > > > > > > > > > On Wed, Jan 29, 2014 at 1:59 PM, Sander Elias <[email protected]>wrote: > >> Hi Michael, >> >> That makes it only a bit more work. On every ajax call, save your state, >> when the 302 is resolved, reload the state, and resume with your job. It's >> a bit of a PITA, but it can be done. >> >> Regards >> Sander >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "AngularJS" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/angular/GKkdipdMbdo/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- 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 http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
