Guest Accounts
thirdweb SDK v5.57.0
TypeScript
Guest Accounts
Sometimes users want to get started using your app without logging in. You can now give users an in-memory "guest account" that can then be converted into a standard account by linking another auth method.
import { inAppWallet } from "thirdweb/wallets"
const wallet = inAppWallet();
// Create the temporary guest account
const account = await wallet.connect({
client,
strategy: "guest"
});
When your user is ready, link any other auth method so they can access their account in the future.
import { linkProfile } from "thirdweb/wallets"
await linkProfile(wallet, { strategy: "google" });
Your user can now access this same wallet with their Google account. Until the user links another profile to the wallet, it will be stored in memory and last until they clear their browser cookies or connect a different wallet.
React
Guest Accounts in the Connect UI
Guest accounts are available in the Connect UI just like any other authentication method.
import { ConnectButton } from "thirdweb/react"
import { createWallet } from "thirdweb/wallets"
<ConnectButton
wallets={[
createWallet("inApp", {
auth: {
options: [
"google",
"discord",
"telegram",
"email",
"phone",
"guest"
]
},
})
]}
/>
Bug Fixes and Other Improvements
- Fixed custom ID handling in custom contracts
- Expand getNFTs ERC1155 support