Web3Auth/web3auth-web

Could we pass custom json metadata to algorand blockchain via react app through web3auth

Closed this issue · 1 comments

Hi,
We would like to know if can custom metadata to algorand blockchain on a signup process to either to algorand blockchain via web3 auth using react app no modal.
It would be helpful if we could pass custom metadata json to webauth3.

You can override fetch and do it. A sample of how to do this. You may want to filter only for your url

const { fetch: originalFetch } = globalThis;
globalThis.fetch = (...args) => {
  const [resource, config] = args;
  if (!config) {
    return originalFetch(resource as URL, { headers: { "X-CUSTOM-HEADER": "hello: } });
  }
  if (config.headers instanceof Headers) config.headers.append("origin", LOOKUP_API_ORIGIN);
  else if (Array.isArray(config.headers)) config.headers.push(["origin", LOOKUP_API_ORIGIN]);
  else config.headers = { ...(config.headers || {}), origin: LOOKUP_API_ORIGIN };
  return originalFetch(resource as URL, config);
};