hide token refresh if not partner app
safe_encode reinstated
contacts tests and handling of non utf chars