Skip to content

Wix user information [PERMISSION_DENIED] Error in nextjs #528

@hu1won

Description

@hu1won

Hello,

I would like to obtain user information from Wix in order to use Wix's payment system on the web I operate.
I created a Wix client and entered all key values ​​correctly.
However, an error occurs as shown in the picture below. Please tell me the solution.

errorcode

If this can be resolved, I will load the user information into Wix , log in the user, and proceed with the payment.

Please let me know if this is a realistic logic after resolving the error. You will use a different domain than the domain of the web page created by Wix. I want to load information about Wix from that domain and enable the loaded users to make payments.

  • Why did this problem occur, and is there a way to solve this problem?
  • I attach the code below.
  • My webpage is composed of nextjs.
useEffect(() => {
    async function fetchSession() {
      const session = await getSession();
      if (session) {
        setUserEmail(session.user.email);
      
        const client = createClient({
          modules: {
            authentication,
            members,
          },
          auth: ApiKeyStrategy({
            apiKey: process.env.API_KEY,
            accountId: process.env.ACCOUNT_ID,
            siteId: process.env.SITE_ID,
          }),
        });

        console.log(session.user.email);

        const user  = await client.members
        .queryMembers()
        .eq('loginEmail', session.user.email)
        .find().catch((error) => {
          console.error("=====>>" + error + "<<====");
        }
        );
      }
    }

    fetchSession();
  }, []);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions