Modified endpoint variable to use full window.location.href. Seems to solve edge cases like auth and package installs (Not 100% sure on implications and only tested a few times, maybe try it out locally before accepting)