Office365 Login redirect incorrect

Dear all,

I have succesfully installed ERPNext.

I have set up an URL for it (erp.xxx.com) and the application is accessible via the URL.

I have also set up an Office365 social login and registered my app in the Azure portal with https://erp.xxx.com/api/method/frappe.integrations.oauth2_logins.login_via_office365 as redirect URL.

When I am now using the Social Login button, I am getting logged in to my Office365 account and then get an error message:
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'xxxxxxx-xxxx-xxx-xxxx-xxxxxxx'.

In the browser url bar I can see that the redirect is done to a local IP address:

This is indeed the internal IP address of the server.

Where can I change this redirect URI that not the internal IP but the public URL is used?