Working out some of the quirks with authentication, almost got it working