thirdweb-auth-next icon indicating copy to clipboard operation
thirdweb-auth-next copied to clipboard

Flows doesn't work with accountAbstraction config

Open bilalcorbacioglu opened this issue 1 year ago • 1 comments

Hi!

I tried to validate my In-App wallet auth via the NextJS server side. I used JWT flow.

1- Step 1: Connect Wallet: The user can connect via one of the inAppWallet with Account Abstraction settings. e.g.

import { polygonAmoy } from "thirdweb/chains";
const wallets = [inAppWallet(),];

const accountAbstraction = {
    chain: polygonAmoy,
    factoryAddress: "0xcD3783ab893822421A77A52A8fB77F065DC8715e",
    gasless: true,
};


<ConnectButton wallets={wallets} client={client} accountAbstraction={accountAbstraction} />

2- Step 2: Sign the login payload: It throws an error.

Console.log on server side;

{
  signature: '0x82459ebfaf7a0103f652cdefdee29f0626b8a69d47f6c9e00e42fe946ebd746043c2629ef0a4a0d186134e168d5f1ec6bf844362b8b360a0fa5d52de9244d6e41b',
  payload: {
    address: '0x4a61de7221b90722557c24204c45A43F1821c2B7',
    chain_id: '80002',
    domain: 'localhost',
    expiration_time: '2024-04-24T22:10:30.860Z',
    invalid_before: '2024-04-24T21:50:30.860Z',
    issued_at: '2024-04-24T22:00:30.860Z',
    nonce: 'a36f999a-085e-4b2e-bc29-0308968fa0f5',
    statement: 'Please ensure that the domain above matches the URL of the current website.',
    version: '1'
  }
}
verifiedPayload:  { valid: false, error: 'Invalid signature' }

The same process works without accountAbstraction configuration.

bilalcorbacioglu avatar Apr 24 '24 22:04 bilalcorbacioglu

Im facing the same issue. Found any fixes?

Lashji avatar Jun 17 '24 22:06 Lashji

When using auth with a smart account, make sure to include a chain ID in the payload and client on the createAuth object. See here: https://portal.thirdweb.com/connect/auth#auth-with-smart-accounts-account-abstraction

gregfromstl avatar Aug 17 '24 04:08 gregfromstl