Javascript REST Auth