wix / velo-external-db

MIT License
13 stars 16 forks source link

Wix user information [PERMISSION_DENIED] Error in nextjs #528

Open hu1won opened 5 months ago

hu1won commented 5 months ago

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.

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();
  }, []);
Idokah commented 5 months ago

make sure you set the permission config for this table - take a look here, under permissions, how you can do it.