3
cb219
2y

Getting the angular interceptor working the way I want has proven to be a pain for me. I try to update an auth token, which returns a promise that has to be transformed to an observable again. based on that, redirect to a login page, in case of 401. But nothing works! Either infinite page reload because of the login() promise function of the auth provider or no reaction at all after a router redirect. 😀

Comments
  • 0
    Total shot in the dark. Instead of redirect on 401, do window.location.href = <loginUrl>
  • 0
    Stuff like http interceptors makes me want to write functional code where every function has to be connected to the input and output of every other
  • 0
    @PeterDCarter that's what they are supposed to do.
    I actually produced a logical loophole. Constantly trying to reauthorize an already logged in user since the request did never have the right permissions. The code would always retry to login. Infinite loop.
    The interceptor now does one action only, no more reroute, no more login, no conditional logic.
  • 0
    @cb219 when I reread my message I am not sure if I meant what I meant or the opposite. Either way I was right. Therefore Haskell πŸ˜‰
Add Comment