# Integrating Web3Auth Embedded Wallet SDK with Next.js and Coinbase CDP

**URL:** <https://builder.metamask.io/t/integrating-web3auth-embedded-wallet-sdk-with-next-js-and-coinbase-cdp/3568>\
**Category:** Embedded Wallets (Web3Auth)\
**Tags:** web3auth, embedded-wallets, account-abstraction\
**Created:** [September 25, 2026, 3:43pm UTC](https://builder.metamask.io/t/integrating-web3auth-embedded-wallet-sdk-with-next-js-and-coinbase-cdp/3568 "2026-09-25T15:43:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JAMIL\_AHMAD\_Kalyal](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/jamil_ahmad_kalyal/32/3850_2.png) [@JAMIL\_AHMAD\_Kalyal](https://builder.metamask.io/u/JAMIL_AHMAD_Kalyal)\
**Post date:** [September 25, 2026, 3:43pm UTC](https://builder.metamask.io/t/integrating-web3auth-embedded-wallet-sdk-with-next-js-and-coinbase-cdp/3568/1 "2026-09-25T15:43:42Z")

</div>

### \*\*1. Framework / Environment:\*\*

\* Next.js / React

\* Node.js (Termux / Linux)

### \*\*2. SDK Name & Version:\*\*

\* `@web3auth/modal`: latest

\* `@web3auth/base`: latest

\* Network: Sapphire Devnet

### \*\*3. Issue Description:\*\*

I am integrating Web3Auth with Next.js and Coinbase CDP RPC for Base network. The Client ID is configured in `.env.local`. I want to properly track session logs and handle embedded wallet authentication responses on the frontend.

### \*\*4. Code Snippet:\*\*

```javascript

import { Web3Auth } from “@web3auth/modal”;

import { CHAIN\_NAMESPACES, WEB3AUTH\_NETWORK } from “@web3auth/base”;

const web3auth = new Web3Auth({

clientId: process.env.NEXT\_PUBLIC\_WEB3AUTH\_CLIENT\_ID,

web3AuthNetwork: WEB3AUTH\_NETWORK.SAPPHIRE\_DEVNET,

chainConfig: {

```
chainNamespace: CHAIN_NAMESPACES.EIP155,

chainId: "0x2105",

rpcTarget: "\[https://mainnet.base.org\](https://mainn

```

[et.base.org](http://et.base.org))",

},

});

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/9/92b599d3131e78cf3d3ff01b80e54d69d266f8df.png) [@system](https://builder.metamask.io/u/system)\
**Post date:** [October 20, 2026, 12:13pm UTC](https://builder.metamask.io/t/integrating-web3auth-embedded-wallet-sdk-with-next-js-and-coinbase-cdp/3568/2 "2026-10-20T12:13:52Z")

</div>

Hi,

`chainConfig` and the import from `@web3auth/base` are the old setup. Remove them. On current `@web3auth/modal`, configure Base in the dashboard. `0x2105` is Base mainnet.

This project is Sapphire Devnet, and the RPC in your snippet is Base mainnet. Use Sapphire Mainnet for Base mainnet.

The client ID in `NEXT_PUBLIC_WEB3AUTH_CLIENT_ID` is fine. Do not put the client secret in the Next.js app.

`web3auth.connected` is the session flag. After login, `getUserInfo()` is the user and `getAuthTokenInfo()` is the identity token.

- [Web SDK v11 Migration Guide | MetaMask developer documentation](https://docs.metamask.io/embedded-wallets/migration-guides/web/)
- [Embedded Wallets events and status | MetaMask developer documentation](https://docs.metamask.io/embedded-wallets/sdk/js/events)
- [getAuthTokenInfo | MetaMask developer documentation](https://docs.metamask.io/embedded-wallets/sdk/js/usage/get-auth-token-info)

> Note: This response was generated by an AI bot and may require further verification. The MetaMask Community Team has tracked this issue and will be responding as soon as possible.
