Whitelisting domains from our backend and not web3auth dashboard

we are trying to whitelist domains from our backend instead from your dashboard, we found in the community a snippet of code from 2022 that shows how to do it, but our dev says there no option to add original data inside the adapterSettings.
this is the snippet we found:

const whitelistedDomains = {
https://tenant1.example.com”: “TENANT1_ DOMAIN_SIGNATURE”,
// signature that you generated above in step 3
https://tenant2.example.com”: “TENANT2_ DOMAIN_SIGNATURE”,
}
const adapter = new OpenloginAdapter({ adapterSettings: { originData: whitelistedDomains } });

we are using :

    "@web3auth/auth-adapter": "^9.4.4",
    "@web3auth/base": "^9.4.4",
    "@web3auth/ethereum-provider": "^9.4.4",
    "@web3auth/no-modal": "^9.4.4",
    "@web3auth/no-modal-react-hooks": "^9.4.4",
    "@web3auth/openlogin-adapter": "^8.12.4",
    "@web3auth/wallet-connect-v2-adapter": "^9.4.4",

was wondering how it can be impletemed using our piece of code
import { AuthAdapter } from “@web3auth/auth-adapter”;
import { IWeb3AuthCoreOptions, WEB3AUTH_NETWORK } from “@web3auth/base”;
import { EthereumPrivateKeyProvider } from “@web3auth/ethereum-provider”;
import { Web3AuthNoModal } from “@web3auth/no-modal”;
import state from ‘…/…/state’;
const initWeb3Auth = async (): Promise => {
try {
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: {
chainConfig: state.web3AuthCfg as any
},
});
const web3AuthOptions: IWeb3AuthCoreOptions = {
clientId: state.web3_auth_token,
web3AuthNetwork: WEB3AUTH_NETWORK.CYAN,
privateKeyProvider,
};
const web3auth = new Web3AuthNoModal(web3AuthOptions);
const authAdapter = new AuthAdapter();
web3auth.configureAdapter(authAdapter);
await web3auth.init();
return web3auth;
} catch (error) {
console.error(“Web3Auth initialization error:”, error);
throw error;
}
};
export default initWeb3Auth;

Hello ido bino! Thank you for sharing the details of your issue with whitelisting domains from your backend. It sounds like you’re trying to adapt the code for your specific needs, which is great!

Based on your message, here’s a summary for the support team:

Issue Summary:

  • SDK Details: Help - Plug n Play
  • SDK Version Numbers:
    • @web3auth/auth-adapter: ^9.4.4
    • @web3auth/base: ^9.4.4
    • @web3auth/ethereum-provider: ^9.4.4
    • @web3auth/no-modal: ^9.4.4
    • @web3auth/no-modal-react-hooks: ^9.4.4
    • @web3auth/openlogin-adapter: ^8.12.4
    • @web3auth/wallet-connect-v2-adapter: ^9.4.4
  • Platform: Not explicitly mentioned, but appears to be JavaScript/TypeScript.

Details of the Issue:

  • You are attempting to whitelist domains from your backend but are having trouble because your developer indicates there is no option to add original data inside the adapterSettings.
  • You referenced a code snippet from 2022 which shows how to set up whitelisted domains, but it seems it may not align with the current SDK.

Proposed Steps:

  1. Check Current SDK Documentation: The SDK and adapter properties may have changed since the snippet you found. It would be best to refer to the most recent documentation for OpenloginAdapter and AuthAdapter.
  2. Implementation in Your Code: The whitelisting may require adapting to the current structure of your code. There might be new parameters or methods available that are not present in the older snippet.

Questions for Further Clarification:

  • Are you getting any specific errors when implementing this, or is it mainly a matter of configuration?
  • Do you have any specific links to the documentation or community threads addressing this issue?

Thank you for sharing your code snippet too! It helps provide context for the issue. I hope the support team can assist you further! If you have any more questions or need clarification, feel free to ask!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

  1. const authAdapter = new AuthAdapter({ adapterSettings: originData: [‘https://www.text.com’]});
    exmaple for error, seems there is no originDate inside adapterSettings…

  2. Developer dashboard api for whitelisting domains. · Web3Auth · Discussion #398 · GitHub

hello? anyone? please help

Hi,
you can refer this to configure manual whitelisting

Module ‘“@web3auth/auth”’ has no exported member ‘whitelistUrl’.ts(2305)
import whitelistUrl

Module ‘“@web3auth/base”’ has no exported member ‘CommonPrivateKeyProvider’.ts(2305)
import CommonPrivateKeyProvider

import { AuthAdapter } from “@web3auth/auth-adapter”;
import { whitelistUrl } from “@web3auth/auth”;
import { CommonPrivateKeyProvider, IWeb3AuthCoreOptions, WEB3AUTH_NETWORK } from “@web3auth/base”;
import { Web3AuthNoModal } from “@web3auth/no-modal”;
let cachedWeb3Auth: Web3AuthNoModal | null = null;
let initializationPromise: Promise | null = null;
const clientId =${clientId}";
const clientSecret = ${clientSecret};
const origin = window.location.origin;
// Initialize Web3Auth
const initWeb3Auth = async (): Promise => {
// Return cached instance if available
if (cachedWeb3Auth) {
return cachedWeb3Auth;
}
// If initialization is in progress, return the existing promise
if (initializationPromise) {
return initializationPromise;
}
// Create new initialization promise
initializationPromise = (async () => {
try {
// Generate a whitelist signature for URL whitelisting
const sig = await whitelistUrl(clientId, clientSecret, origin);
// Configure private key provider
const privateKeyProvider = new CommonPrivateKeyProvider({
config: {
chainConfig: state.web3AuthCfg as any
},
});
// Configure Web3Auth options
const web3AuthOptions: IWeb3AuthCoreOptions = {
clientId: state.web3_auth_token,
web3AuthNetwork: WEB3AUTH_NETWORK.CYAN,
privateKeyProvider,
};
const web3auth = new Web3AuthNoModal(web3AuthOptions);
// Configure Auth Adapter with URL whitelist signature
const authAdapter = new AuthAdapter({
privateKeyProvider,
adapterSettings: {
originData: { [origin]: sig },
},
});
web3auth.configureAdapter(authAdapter);
await web3auth.init();
// Cache the instance
cachedWeb3Auth = web3auth;
return web3auth;
} catch (error) {
console.error(“Web3Auth initialization error:”, error);
// Clear the initialization promise on error
initializationPromise = null;
throw error;
}
})();
return initializationPromise;
};
export const clearWeb3AuthCache = () => {
cachedWeb3Auth = null;
initializationPromise = null;
};
export default initWeb3Auth;
@web3auth/auth”: “^9.6.3”,
@web3auth/auth-adapter”: “^9.5.2”,
@web3auth/base”: “^9.5.2”,
@web3auth/base-provider”: “^9.5.2”,
@web3auth/ethereum-provider”: “^9.5.2”,
@web3auth/no-modal”: “^9.5.2”,
@web3auth/no-modal-react-hooks”: “^9.5.2”,
@web3auth/openlogin-adapter”: “^8.12.4”,
@web3auth/wallet-connect-v2-adapter”: “^9.5.2”,

help please @cherngwoei

@cherngwoei please assist us

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Hey @idob,

Thanks for your patience! We’ve just updated the Manual Whitelisting documentation to align with the latest SDK changes. Since whitelistUrl was removed during the transition from @toruslabs/openlogin to @web3auth/auth, we’ve now included an inline implementation of the function directly in the docs.

You can check out the updated guide here:
:link: Whitelisting your App Domain or Deep Links

This should allow you to whitelist domains from your backend without using the Web3Auth Developer Dashboard.