Hello evreyone, I'm Jose and I'm trying to integr...
# general
b
Hello evreyone, I'm Jose and I'm trying to integrate a self-hosted instance of Kratos with Next 15 and App Router. When I try to build the login or registration pages in next everything goes correctly if I manually do the redirect to
<http://localhost:4433/self-service/login/browser>
, then I get redirected by kratos to the correct url with a flow query param, however when I follow the example in the
elements
repo, I the
getLoginFlow
redirects to the wrong URL, I tried a couple of things to try it to pick the right URL: • Specifying the url in the env variable
NEXT_PUBLIC_ORY_SDK_URL
• Specifying it in the config object passed to the
getLoginFlow
/
getRegistrationFlow
const config = enhanceOryConfig(baseConfig, "<http://localhost:4433>");
In both cases i got the same result, as son as I enter the page I get redirected to
localhost:3000/self-service/login/browser
instead of the kratos url Here I leave you a couple of clocks of code used in my next project, they look pretty similar to whats on the example
Copy code
// login/page.tsx
import { getLoginFlow, OryPageParams } from "@ory/nextjs/app";
import baseConfig from "../../../ory.config";
import { enhanceOryConfig } from "@ory/nextjs";

export default async function LoginPage(props: OryPageParams) {
  const config = enhanceOryConfig(baseConfig, "<http://localhost:4433>");
  const flow = await getLoginFlow(config, props.searchParams);
  if (!flow) {
    return null;
  }
  return (
    <div className="h-screen w-full flex items-center justify-center p-4 flex-col">
      <pre>{JSON.stringify(config, null, 2)}</pre>
      Login Page
    </div>
  );
}
Copy code
// ory.config.ts
import type { OryConfig } from "@ory/nextjs"

const config: OryConfig = {
  override: {
    applicationName: "Test APP",
    loginUiPath: "/login",
    registrationUiPath: "/signup",
    recoveryUiPath: "/recovery",
    verificationUiPath: "/verification",
    settingsUiPath: "/settings",
    defaultRedirectUri: "/",
  },
}

export default config
Thank you very much in advance