How to connect a custom wallet to moralis programatically?

I have a Dapp and a custom wallet, I want them to connect programatically and use moralis as it makes things more easy to work with. I thought of connecting the wallet to moralis via custom connector and then authenticate, or if I can do that programatically using wallet connect. Please do suggest any ways possible

Yes you can use a custom connector. Where is this wallet based e.g. is it an extension or a mobile app?

The wallet is a random wallet created using ethersJS library, and both the dapp and wallet are on same application.

I tried with custom connector, but didnโ€™t get where do I need to pass my wallet object

In that case, I donโ€™t think you can use a connector in that way, itโ€™s not a wallet provider. Itโ€™s just a wallet you generated with ethers.js.

You can use ethers.js to connect to that wallet using its private key.

Loading the wallet using PK I get it, but how can I connect that wallet to Moralis is my question

Not sure, what did you try with your connector? You can post your code here. You need to use a provider in some way.