Hi @Søren Brønsted ,
I understand that you are being directed to the wrong URL. You need to specify the redirect URI in the login URL and specify where the user and authorization code should be redirected. If you don't specify a Redirect URI in the Login URL, the user will be redirected to the first URL specified in the app's registration.
To resolve this, you can follow the example in the Authorization Code Grant Flow documentation to specify the Redirect URI:
https://login.microsoftonline.com/{tenant}/oauth2/authorize?
client_id=xxxxxx
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
&response_mode=query
&resource=https%3A%2F%2Fservice.contoso.com%2F
&state=12345
Otherwise you could list the URL that you want as the first one in the registration.
Let me know if you have further questions.
Additional reading: https://stackoverflow.com/questions/46917919/azure-ad-reply-url-how-to-add-several-urls-when-using-openid-connect-auth