Onboard a user to Moralis DB without Metamask

We have a Defi Dashboard app. Users log in by providing a wallet address in a web form, not through Metamask. We’d like the wallet to be synced into the Moralis DB, on all supported EVM chains. We do not want to use MetaMask, WalletConnect, etc, just the web form input. How do we do it?

Thanks!

you can add an address to watch programatically: https://docs.moralis.io/moralis-server/automatic-transaction-sync/historical-transactions#monitoring-non-authenticated-address

I tried, but I’m doing something wrong. Can you help?

It needs master key, you can find in documentation how to give it as parameter. It will be also as a parameter to Moralis.start if you run from nodejs

Thanks. I read this but am not sure how to apply to our situation. https://docs.moralis.io/moralis-server/database/security

What solution to apply? You need to send parameter as master key. You can search in documentation how to use master key in a cloud function.

@cryptokid I used master in start() method, but after save:

const ObjUser = Moralis.Object.extend("History");
const user = new ObjUser();
user.set("wallet", wallet);
const response = await user.save(null, { useMasterKey: true });

The changes are not saved deleted, but I get a response:

image

Why is this happening?

that code seems to create a history object, set a field in that object and then save an unrelated object named used

@cryptokid I messed up the servers, my fault

the code should look like this:

x = async () => {
    const  Moralis = require('moralis/node')
    console.log(Moralis.CoreManager.get("VERSION"))
    await Moralis.start({ serverUrl: "https://asfasdf:2053/server", appId: "afasdf", masterKey: "fasdfasdf" });

    const results = await Moralis.Cloud.run("watchEthAddress", {address: "fasdfasdfsdf", syncHistorical: true}, {useMasterKey: true})
    console.log(results)
    }
x();

1 Like