How to use masterkey to save the user address

hey , dear tech team
i wanna save the user address in dashboard use masterkey in froutend or cloud code .

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>

    </title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="generator" content="" data-variable="/,cn,64,,2,res024"
    />
   
    <style>
        .button {

            background-color: white;
            color: #000000;

            border-radius: 5px;
            width: 140px;
            height: 31px;
            font-size: 16px;
            border: 3px black solid;
        }
        p{
            width: 100%;
            border-bottom: 1px solid black;
        }
        section.bgc{
            background-color: black;
            color: #e98f2e;
        }
        body{
            background-color: black;
            color: #e98f2e;
        }

    </style>
</head>
<body>





<section id="tit">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <h2  style="text-align: center;">BSC wallet connect </h2>
            </div>
        </div>
        <div class="row">
            <div style="text-align: center;margin-top: 30px;">
             <button id="btn-login">connect wallet Login</button>
    <button id="btn-logout">Logout</button>
    <button id="call">call</button>
               
              
            </div>
        </div>
    </div>
</section>


<section class="met-news  bgc  "style="margin-top: 10%" >
    <div class="container ">
        <div class="row">
            <div class="col-md-12 " >
                <div class="row">
                    <div class="met-news-list" style=" background-color: #e98f2e;border: 3px black solid;border-radius: 5px;">
                        <ul class="met-page-ajax" data-scale=''>
                            <li >
                                <div >
                                    <div >
                                        <h3 class="media-heading" style="color:black">
                                    


  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"></script>
    <script src="https://unpkg.com/moralis/dist/moralis.js"></script>
     <script src="https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.7.1/web3-provider.min.js"></script>
<script>
 const serverUrl = "https://w9xhehununel.usemoralis.com:2053/server";
      const appId = "KxzRkHYm77M2UunBitVKZUctiUsyGR1TWWOIE5KN";
      Moralis.start({ serverUrl, appId });
      async function login() {
        const web3 = await Moralis.enableWeb3({ provider: "walletconnect", chainId: 56 });
      const userBig_address = await Moralis.User.current(get("ethAddress"));
        await Moralis.enableEncryptedUser();
Moralis.secret = 'masterkey';
        console.log (userBig_address);
      
     
        
       
        }
 async function logOut() {
        await Moralis.User.logOut();
        console.log("logged out");
      }
 document.getElementById("btn-login").onclick = login;
      document.getElementById("btn-logout").onclick = logOut;
      document.getElementById("call").onclick = call;
    </script>

</body>
</html>

here is the code .cloud is empty now .
here is the host https://bsc-test.carterwu768210.repl.co
consloe is get is not defind.
thanks in advance .

you can use the master key only in cloud code and not in front end

some examples:
https://docs.moralis.io/moralis-dapp/cloud-code/cloud-functions#using-the-master-key-in-cloud-code

async function login() {
        const web3 = await Moralis.enableWeb3({ provider: "walletconnect", chainId: 56 });
      
       }

    async function saveUsers() {
     const results = await Moralis.Cloud.run("getUsers");
  console.log("I hope i saved ", results);
    }

html

Moralis.Cloud.define("getUsers", async (request) => {
    const query = new Moralis.Query(Moralis.User.current(get("ethAddress")), { useMasterKey: true });
    const results = await query.find({ useMasterKey: true });
    return results;
  const Userdata = new Moralis.Object.extend('Userdata')
    const userdata = new Userdata();
  userdata.set("allUsers",results )
 await userdata.save() ;
});

cloud function.

it didnt saved

await saveUsers()
moralis.js:26279 POST https://w9xhehununel.usemoralis.com:2053/server/functions/getUsers 400
dispatch @ moralis.js:26279
ajax @ moralis.js:26286
(匿名) @ moralis.js:26393
Promise.then(异步)
request @ moralis.js:26387
run @ moralis.js:457
run @ moralis.js:383
saveUsers @ (索引):96
(匿名) @ VM1492:1
moralis.js:31037 Uncaught Error: get is not defined
at handleError (moralis.js:26415:17)
at async saveUsers ((索引):96:22)
at async :1:1
thanks for your help in advance . thanks for understanding i am new and beginner.but i like it .

Looks like an issue with Moralis.User.current(get("ethAddress").

You should be able to get the address from request.users.

Hi my friend , thanks for your answer [quote=“dbzqiaokeli, post:1, topic:14298”]
const userBig_address = await Moralis.User.current(get("ethAddress"));
[/quote]

const userBig_address = await request users; ?. It’s what’s you advise?

That was referring to your cloud function with the get is not defined error. You should be able to use request.user.ethAddress instead of Moralis.User.current(get("ethAddress") to get the current user’s address.

But your use of Moralis.Query looks incorrect (and I’m not sure what you’re trying to do exactly), can you read this.