Anybody having issues with Moralis.Web3.authenticate()?


When I just execute this:

await Moralis.Web3.authenticate();

I get following happy message in the browser console:

moralis.js:23696 Uncaught (in promise) Error: A duplicate value for a field with unique values was provided
at handleError (moralis.js:21728)

I clear User collection, try it again and have the same error (one row gets created in User collection in the process). Anyone could shed some light on this topic?

Hi! You have a problem in the frontend. Share your Auth module code.

1 Like

Thank you for the reply! ‘Auth module’ sounds very sophisticated for what I have. I run only this to get this error - this is basically my whole test main.js script:

$(document).ready(function() {
async function init() {
await Moralis.Web3.authenticate();

I encountered some issues with getting user using Moralis.User.current() so I started to strip down the code, restarted the server, all such desperate things people do, and then I encoutered this issue.

Are you trying to sign up an address that is already registered?

Well, 10 points for Gryffindor! Thank you! When I delete corresponding address entry from _EthAddress it goes fine. New document in User is created ok and without error.

Before I just removed User collection content. Each time authenticate() run it created one more document in User, but without accounts field populated and there was this duplicate value error. Now I can’t replicate this issue.

1 Like