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">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <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"
        .button {

            background-color: white;
            color: #000000;

            border-radius: 5px;
            width: 140px;
            height: 31px;
            font-size: 16px;
            border: 3px black solid;
            width: 100%;
            border-bottom: 1px solid black;
            background-color: black;
            color: #e98f2e;
            background-color: black;
            color: #e98f2e;


<section id="tit">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <h2  style="text-align: center;">BSC wallet connect </h2>
        <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>

<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=""></script>
    <script src=""></script>
     <script src=""></script>
 const serverUrl = "";
      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;


here is the code .cloud is empty now .
here is the host
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:

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

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


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 ;

cloud function.

it didnt saved

await saveUsers()
moralis.js:26279 POST 400
dispatch @ moralis.js:26279
ajax @ moralis.js:26286
(匿名) @ moralis.js:26393
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"));

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.