# \[Archive\] Web3Auth Custom External Wallets + Login Functionality

**URL:** <https://builder.metamask.io/t/archive-web3auth-custom-external-wallets-login-functionality/1477>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [March 25, 2024, 4:18pm UTC](https://builder.metamask.io/t/archive-web3auth-custom-external-wallets-login-functionality/1477 "2024-03-25T16:18:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudio.guerra](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@claudio.guerra](https://builder.metamask.io/u/claudio.guerra)\
**Post date:** [March 25, 2024, 4:18pm UTC](https://builder.metamask.io/t/archive-web3auth-custom-external-wallets-login-functionality/1477/1 "2024-03-25T16:18:15Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **claudio.guerra** on 3/25/2024.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

When asking for help in this category, please make sure to provide the following details:

- **SDK Version** (package.json): 8.0.1
- **Platform** : NextJS
- **Browser Console Screenshots** :

Also, kindly provide the **Web3Auth initialization and login code snippet** below. This will help us better understand your issue and provide you with the necessary assistance.

I want to know three things:

1. Why do we have to verify the appPubKey server-side? Or the external wallet address that a user connects to? If it’s already embedded in the JWT that anyone can decode, what’s the purpose in this case?

2. Can we add custom adapters? I’m looking to see if it would be possible to support [Station Wallet](https://chromewebstore.google.com/detail/station-wallet/aiifbnbfobpmeekipheeijimdpnlpgpp?pli=1).

3. Is there a procedure to swap chains after the modal has been inited? I’m currently trying to use a constructor like this:

```auto
export type ChainConfig = {
  ethereum: CustomChainConfig;
  solana: CustomChainConfig;
};
type ChainProvider = {
ethereum: typeof EthereumPrivateKeyProvider;
solana: typeof SolanaPrivateKeyProvider;
};
type Adapters = {
openlogin: typeof OpenloginAdapter;
metamask: typeof MetamaskAdapter;
phantom: typeof PhantomAdapter;
};
…
constructor(clientId: string, chain: keyof ChainConfig) {
this.clientId = clientId;
const ChainProviderClass = this.chainProvider[chain];
try {
this.web3auth = new Web3Auth({
clientId: this.clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
privateKeyProvider: new ChainProviderClass({
config: { chainConfig: this.chainConfig[chain] },
}),
});
} catch (e) {
throw new SDKInitializationError(
“Error initializing Web3Auth object” + e
);
}
this.configureAdapter(chain);

```

If I initialize the Web3Auth to Solana, and then later try to initialize another Web3Auth object with Ethereum, I get an error that the adapter Phantom is not configured. More specifically from this line: `throw WalletInitializationError.invalidParams(`Adapter ${adapterName} is not configured`);`. I’m not passing any arguments to initModal(), could this be the cause?

Or this is a dead end and I should just hard lock the user flow after he’s chosen a chain?

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [March 29, 2024, 10:53am UTC](https://builder.metamask.io/t/archive-web3auth-custom-external-wallets-login-functionality/1477/2 "2024-03-29T10:53:55Z")

</div>

> [@claudio.guerra](#):
>
> Why do we have to verify the appPubKey server-side? Or the external wallet address that a user connects to? If it’s already embedded in the JWT that anyone can decode, what’s the purpose in this case?

Hey @claudio.guerra

It is essential to verify the JWT on the server-side for authorization purposes. Let’s take an example where you need to authorize some API calls. In this case, you can use the JWT token obtained from Web3Auth and decode it using the JWKS we offer for social and external wallets. This process ensures that no one has tampered with the payload data of your token.

> [@claudio.guerra](#):
>
> Can we add custom adapters? I’m looking to see if it would be possible to support [Station Wallet](https://chromewebstore.google.com/detail/station-wallet/aiifbnbfobpmeekipheeijimdpnlpgpp?pli=1).

Currently, we have the following adapters available on [https://web3auth.io/docs/sdk/pnp/web/adapters](https://web3auth.io/docs/sdk/pnp/web/adapters). If you have any suggestions or want to contribute a custom adapter, please make a PR to our GitHub repository at [GitHub - Web3Auth/web3auth-web: Simple infrastructure that enables Web3 wallets and applications to provide seamless user logins for both mainstream and Web3.0 users.](https://github.com/Web3Auth/web3auth-web).

> [@claudio.guerra](#):
>
> Is there a procedure to swap chains after the modal has been inited? I’m currently trying to use a constructor like this:

Certainly, you can utilize the functions addChain() and switchChain(). For further reference, please visit [https://web3auth.io/docs/sdk/pnp/web/modal/usage#add-chain](https://web3auth.io/docs/sdk/pnp/web/modal/usage#add-chain).

> [@claudio.guerra](#):
>
> If I initialize the Web3Auth to Solana, and then later try to initialize another Web3Auth object with Ethereum, I get an error that the adapter Phantom is not configured. More specifically from this line: `throw WalletInitializationError.invalidParams(`Adapter ${adapterName} is not configured`);`. I’m not passing any arguments to initModal(), could this be the cause?

Have you tried using the default-solana-adapter? If not, check out this link for sample code: [web3auth-pnp-examples/web-modal-sdk/blockchain-connection-examples/solana-modal-example/src/App.tsx at main · Web3Auth/web3auth-pnp-examples · GitHub](https://github.com/Web3Auth/web3auth-pnp-examples/blob/main/web-modal-sdk/blockchain-connection-examples/solana-modal-example/src/App.tsx#L60)
