Added authorization for the backend and fixed redirect stack overflow.