Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when authenticating in NextJs environment #1536

Open
tusmester opened this issue Oct 4, 2023 · 0 comments
Open

Error when authenticating in NextJs environment #1536

tusmester opened this issue Oct 4, 2023 · 0 comments
Labels
bug Something isn't working frontend

Comments

@tusmester
Copy link
Member

tusmester commented Oct 4, 2023

"use client";
import React from "react";
// @ts-ignore
import { AuthenticationProvider } from "@sensenet/authentication-oidc-react";
import { useRouter } from "next/navigation";
import { usePathname } from "next/navigation";

export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
  const pathname = usePathname();

  const router = useRouter();

  const location = typeof window !== "undefined" ? window.location.origin : "";

  /*A repos Dolgokat process.env-be kelle tenni*/
  const configuration = {
    client_id: "AWahlJ7aLQPuDUAC", // spa clientID of your repository

    automaticSilentRenew: true,

    redirect_uri: `${location}/authentication/callback`,

    response_type: "code",

    post_logout_redirect_uri: `${location}/`,

    scope: "openid profile sensenet",

    authority: "https://eddie-is.sensenet.cloud",

    silent_redirect_uri: `${location}/authentication/silent_callback`,

    extraQueryParams: { snrepo: "https://eddie.sensenet.cloud" },
  };

  const history = {
    location: pathname,
    push: router.push,
  };

  return (
    <AuthenticationProvider configuration={configuration} history={history}>
      {children}
    </AuthenticationProvider>
  );
};

That was the implementations of the authentication and thats the error

image

@tusmester tusmester added bug Something isn't working frontend labels Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend
Projects
None yet
Development

No branches or pull requests

1 participant