energywebfoundation / iam-client-lib

TypeScript library to be used within decentralised applications for authentication and authorisation using DIDs (Decentralised Identifiers) and VCs (Verifiable Credentials)
GNU General Public License v3.0
19 stars 9 forks source link

Change Auth Domain #750

Open jaysondave opened 11 months ago

jaysondave commented 11 months ago

When login with metamask, it is warning like below. The site you're attempting to sign into doesn't match the domain in the request. Proceed with caution. image

I deployed energy web repo to my own domain.

Steps to reproduce

  1. Go to switchboard.met3r.com
  2. Login to metamask

https://energy-web-foundation-iam-client-lib.readthedocs-hosted.com/setup/initialization/ The docs says a way to override auth domain in setChainConfig method but there is not any option of auth.domain in ChainConfig interface.

export interface ChainConfig {
    chainName: Chain;
    chainDisplayName: string;
    rpcUrl: string;
    ensRegistryAddress: string;
    ensResolverV2Address: string;
    ensResolverAddress: string;
    ensPublicResolverAddress: string;
    domainNotifierAddress: string;
    assetManagerAddress: string;
    didRegistryAddress: string;
    claimManagerAddress: string;
    stakingPoolFactoryAddress: string;
    credentialRevocationRegistryAddress: string;
    claimsRevocationRegistryAddress: string;
}
jrhender commented 11 months ago

Hi @jaysondave , apologies for the long delay here. December is quite a busy time at Energy Web but we will endeavour to have quicker replies for future issues!

I think this should be possible to fix in your case as I see that we are setting the default domains for Volta and EWC here: https://github.com/energywebfoundation/iam-client-lib/blob/880ae80a2dcebd8c2d1974bc28b2c59207ff48fe/src/config/cache.config.ts#L9

I think our documentation is wrong and you should try setCacheConfig rather than setChainConfig https://github.com/energywebfoundation/iam-client-lib/blob/880ae80a2dcebd8c2d1974bc28b2c59207ff48fe/src/config/cache.config.ts#L23

Please let me know if this helps you out. If not, I can ask the team to continue to investigate further.