Authenticate MetaMask iOS browser: Error: Not Allowed

I’m using the code from the YouTube tutorial: https://github.com/MoralisWeb3/youtube-tutorials/tree/main/react-metamask-login

I’ve updated Moralis dependencies to the latest:

“dependencies”: {

“magic-sdk”: “7.0.0”,
“moralis”: “^1.3.2”,
“react-moralis”: “^1.3.1”
},

Desktop works fine, as well as Coinbase Wallet mobile browser

When using MetaMask mobile browser I get “Error: Not Allowed”

you mean that you opened your app in the internal browser provided by metamask?

where from is that error?

Yes, internal MetaMask browser.

The error comes from:

const { …, authError} = useMoralis()

can you try it outside of the metamask browser ? like on chrome or safari ?

Also, I get this error in Moralis Logs

Screenshot 2022-02-21 at 10.31.58

it works outside MetaMask browser

@0xprof @cryptokid

Here’s also another log

I think I’m nailing down where the error comes from.

I have this Cloud Function to prevent users changing some user fields:

Moralis.Cloud.beforeSave(Moralis.User, (request) => {
const userObject = request.object;
if (!request.master && userObject.dirty(“coupon”) || !request.master && userObject.dirty(“raffle”)) {
throw “Not allowed.”;
}
});

The question now is, how to adjust it to allow new user creations?

it looks like you have to update this logic

well, I don’t see anything wrong with these statements :sweat_smile:

weird…

How do I check if a field coming from userObject has the default value on creation?

Ok, I found a fix:

Moralis.Cloud.beforeSave(Moralis.User, (request) => {
    const userObject = request.object;
    if (userObject.id && !request.master && userObject.dirty("coupon") || userObject.id && !request.master && userObject.dirty("raffle")) {
        throw "Not allowed.";
    }
});

If there’s a better way to check, please let me know :slight_smile: