Fix unset username and userid in the API when using tokens.