Hello @Joaquín Viana Guelfi ,
This error: AADSTS650052 is caused by your application requesting a scope from a multi-tenant resource/application not yet registered in your tenant. That is the resource is hosted in another tenant.
Use the following PowerShell script to register the multi-tenant app in your tenant.
Connect-AzureAD -TenantId "599e51d6-2f8c-4347-8e59-1f795a51a98c"
New-AzureADServicePrincipal -AppId <MULTI TENANT APP ID>
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.