Only try to delete token if the token create succeeded

Otherwise the code tries to access 'data' which might
not be valid JSON.