Keycloak doesn't redirect to AzureAD login

Hello!
I’m trying to setup a “simple” example of Keycloak with AzureAD as an oidc provider, and NextJS with AuthJS. There’s a couple of problems…

First of all, if I’m when I try to signin with AzureAD, the link is wrong.
The root url, is the url of the keycloak instance and not https://login.microsoftonline.com/

I can then manually change the URL, the the correct AzureAD url, and login works fine, but then afterwards, the redirect back again, is to the root url of the Keycloak instance, and not the client application that requested the login, at http://localhost:3000 - again, changing the url manually works.

Any ideas? Is it keycloak or AuthJS?

EDIT: Found this in the logs of keycloak: Error response 404: jakarta.ws.rs.NotFoundException: Unable to find matching target resource method

I’m using hostname, if that makes any difference. The log is when I click the link to login with Azure, which should redirect me to the Azure login