Custom authentication using v1

Any idea how to use this option with rainbowkit wallet?

V1 doc does not provide a good example for this TBH.

Moralis.authenticate({ connector: CustomConnector })

so connector instrance has a structure of

  interface Connector {
    type: string;
    network: string;
    account: null | string;
    chainId: null | string;
    activate: () => Promise<{
      provider: Provider;
      account?: string | null;
      chainId?: string | null;
    }>;
    deactivate: () => Promise<void>;
    [key: string]: any;
  }

Can it go well with rainbowkit when user selects coinbase, walletconnect, etc
Looking at wagmi’s useConnect or useProvider but not sure how to implement!

It may be possible. Yes there are no specific examples for RainbowKit but you can look at an existing connector for how to get started.

You would need to use @wagmi/core instead of wagmi - React hooks e.g. useConnect can only be used in other hooks or function components.

Thanks, but I guess I won’t be able to do it. Wanted to use moralis db with only authenticated user with session to upload data, but unfortunate that it’s only possible with a few wallet types or at least need some example code snippets for that

You can solve this by using Auth api from v2 sdk. With auth api you can verify users at your own backend, without relying on Moralis backend.

Yeah I was thinking about that too, but Moralis backend provides much more convenience for a startup.
However, it’d be awesome if it can support more mainstream wallets :slight_smile: