Invalid response from Anchor, cannot login
benjiewheeler opened this issue · comments
Description
I'm getting this error when trying to login with Anchor on desktop
Error: Invalid response from Anchor, must contain link_ch, link_key, link_name and cid flags.
Details
OS: Zorin OS 16.2 (Based on Ubuntu 20.04)
Browser: Google Chrome 109.0.5414.119
Anchor version: 1.3.7
Websocket data (from URL: wss://cb.anchor.link)
{
"sig": "SIG_K1_...",
"tx": "380bc...29",
"rbn": "0",
"rid": "0",
"ex": "2023-03-14T21:20:41",
"req": "esr://g2PgY...",
"sa": "<account_name>",
"sp": "active",
"cid": "10644...a4"
}
Steps to reproduce
- run
pnpm create vite
& select react + typescript & install dependencies - edit
App.tsx
to the following - login with Anchor wallet
import { BrowserLocalStorage, Session, SessionKit } from "@wharfkit/session";
import { WalletPluginAnchor } from "@wharfkit/wallet-plugin-anchor";
import { WalletPluginCloudWallet } from "@wharfkit/wallet-plugin-cloudwallet";
import { WebUIRenderer } from "@wharfkit/web-ui-renderer";
import { useState } from "react";
import "./App.css";
const ui = new WebUIRenderer();
const anchor = new WalletPluginAnchor();
const wcw = new WalletPluginCloudWallet();
const sessionKit = new SessionKit({
appName: "demo",
chains: [
{
id: "1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4",
url: "https://wax.greymass.com",
},
],
ui,
walletPlugins: [anchor, wcw],
transactPlugins: [],
storage: new BrowserLocalStorage("wharf-test-"),
});
function App() {
const [session, setSession] = useState<Session>(null);
const login = async () => {
const loginResult = await sessionKit.login();
setSession(loginResult?.session);
};
return (
<div className="App">
<div className="wallet">{session?.actor?.toString()}</div>
<div className="card">
<button onClick={() => login()}>Login </button>
</div>
</div>
);
}
export default App;
Expected Behavior
Logging in normally without throwing this error
Additional notes
The login process works normally when scanning the QR code with Anchor from an Android device
Hey there, thanks for reaching out! You're getting this error because the response that you shared is not a valid Anchor response (Anchor responses must contain link_ch, link_key and link_name flags). Are you using the latest version of Anchor Desktop?