Skip to content

passkey session being wiped out when calling addOauthProvider on signer #1889

@alexwaumann

Description

@alexwaumann

Thanks for filling out this bug report. Please provide as much detail as possible.

If your issue is with our RPC APIs and not the SDK please report your issue on (discord)[https://alchemy.com/discord].

[REQUIRED] Environment

  • Browser version: Chrome v138.0.7204.185
  • AA SDK version: 4.55.0
  • Package: @account-kit/core, @account-kit/signer

[REQUIRED] Describe the problem

After authenticating with a passkey, it seems that calling signer.addOauthProvider(...) is wiping out the passkey session since every subsequent call that requires the signer's sig (include the addOauthProvider call itself) fails with the error: Error: cannot sign payload without credential. Credential bytes are null. Has a credential bundle been injected into the iframe?

PR #1154 resolved it at some point as seen in discussion #1133; however, the issue seems to be present again.

How to reproduce:

  1. Use config w/ enablePopupOauth and hydrate
export const alchemyAccountsConfig = createConfig({
  chain: optimismSepolia,
  transport: alchemy({ apiKey: import.meta.env.VITE_ALCHEMY_KEY }),
  policyId: import.meta.env.VITE_ALCHEMY_POLICY_ID,
  sessionConfig: { storage: "localStorage", expirationTimeMs: 1000 * 60 * 60 },
  enablePopupOauth: true,
});

hydrate(alchemyAccountsConfig)
  .onMount()
  .catch(() => console.error("FAILED TO HYDRATE ACCOUNT KIT"));
  1. Authenticate using passkey:
const signer = getSigner(alchemyAccountsConfig);
signer.authenticate({
  type: "passkey",
  createNew: false,
});
  1. Call addOauthProvider on signer
const signer = getSigner(alchemyAccountsConfig);
signer.addOauthProvider({
  mode: "popup",
  authProviderId: "google",
});
  1. You will encounter error (regardless of whether you complete the oauth or cancel it)
Error: cannot sign payload without credential. Credential bytes are null. Has a credential bundle been injected into the iframe?

Relevant code or sample repro:

https://github.com/alexwaumann/complexjty-ui
NOTE: This is just something I was testing that wasn't working and found it was previously an issue so code to reproduce this is not currently in the main branch but I can push a branch that reproduces if asked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions