Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rupeshKumarAmt opened this issue May 31, 2024 · 1 comment

Comments

@rupeshKumarAmt
Copy link

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.

@chaitanyapotti
Copy link
Member

chaitanyapotti commented Aug 28, 2024

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);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants