When assessing whether consent is freely given, utmost account shall be taken of whether, inter alia, the performance of a contract, including the provision of a service, is conditional on consent to the processing of personal data that is not necessary for the performance of that contract.
So GDPR does not say its illegal, just that it will be determined on case by case basis.
For legal experts, is this facebook consent obtaining GDPR compliant ?
https://www.facebook.com/legal/terms/update
By using or accessing Facebook Services, you agree that we can collect and use such content and information in accordance with the Data Policy as amended from time to time.