WiX AJAX Response Cookie Issues

Hello again Velo Community,

Does anyone have experience getting OAuth and WiX to play nice? I’ve created a Patreon authenticate button that performs a backend GET request on click. Upon doing so I see an exception in the browser console stating:

Cookie “_wixAB3” has been rejected for invalid domain. getAccessToken.ajax
Cookie “TS016e3841” has been rejected for invalid domain. getAccessToken.ajax
Cookie “_wixAB3” has been rejected for invalid domain. getAccessToken.ajax
Cookie “TS016e3841” has been rejected for invalid domain.

Looked into this a bit and found Spring Boot/React users had issues when their response cookie domains began with ., as is the case with the above response cookies i.e.wix.com.

Any suggestions? I have code below and am happy to answer additional questions. Thanks in advance.

Backend code:

import { fetch } from 'wix-fetch';

const REDIRECT_URI = 'https://redirect-uri-here.com';

export async function getAccessToken() {
    const CLIENT_ID = await getSecret("CLIENT_ID");

    fetch(`www.my3rdpartyservice.com/oauth2/authorize?response_type=code&client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}`, { "method": "get" })
        .then((httpResponse) => {
            let statusCode = httpResponse.status;
            let statusText = httpResponse.statusText;

            if (httpResponse.ok) {
                console.log(statusCode);
                console.log(statusText);
                console.log(httpResponse.json());
                return httpResponse.json();
            } else {
                console.log(statusCode);
                console.log(statusText);
                console.log(httpResponse.json());
                return Promise.reject("Fetch did not succeed");
            }
        })
        .then(() => getBearerToken())
        .catch((err) => {
            console.log(err);
        });

Front end code:


 $w('#button1').onClick((e) => {
        getAccessToken();
    })

Did you ever get to the bottom of this and how to resolve it - I have seen your other posting on the internet asking a similar question.