Closed saujanya01 closed 1 month ago
Hello @saujanya01,
The oidc-spa module is designed specifically for OpenID Connect in single-page applications. Next.js, particularly when using the App Router, doesn’t fall into this category because much of its logic is executed on the server.
In the future, I might develop another module, oidc-mpa, tailored for multi-page applications to support Next.js. However, this is not my top priority at the moment, as there is already a decent solution available:
You can use NextAuth.js with the Keycloak adapter.
Best regards,
Thanks for clarification. Closing this issue.
When trying to implement the way given in example, I am getting a ReferenceError: window not defined. This is because of the server side rendering in nextjs 14 app router. Also, looking into the example and the new open pull request (https://github.com/keycloakify/oidc-spa/pull/25) made me wonder if this can work with the routing used in next js. If there is a way to make it work, what would be the best way, if not what are the alternatives I can use other than keycloak-js