export async function fetchSpaceUserToken()

in client/src/app/service/spaceAuth.js [8:24]


export async function fetchSpaceUserToken() {
    let tokenResponse = await new Promise((resolve) => {
        const channel = new MessageChannel();
        channel.port1.onmessage = e => resolve(e.data);
        window.parent.postMessage({
            type: "GetUserTokenRequest",
            permissionScope: "",
            askForConsent: false
        }, "*", [channel.port2]);
    });

    if (tokenResponse != null && tokenResponse.token != null) {
        spaceServerUrl = tokenResponse.serverUrl;
        spaceDomain = new URL(spaceServerUrl).host;
        userToken = tokenResponse.token;
    }
}