{"record":{"id":"9cdad215493f4e7d","repo":"amark/gun","slug":"wrong-user-or-password","errorCode":null,"errorMessage":"Wrong user or password.","messagePattern":"Wrong user or password\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea/auth.js","lineNumber":39,"sourceCode":"      var act = {}, u;\n      act.a = function(data){\n        if(!data){ return act.b() }\n        if(!data.pub){\n          var tmp = []; Object.keys(data).forEach(function(k){ if('_'==k){ return } tmp.push(data[k]) })\n          return act.b(tmp);\n        }\n        if(act.name){ return act.f(data) }\n        act.c((act.data = data).auth);\n      }\n      act.b = function(list){\n        var get = (act.list = (act.list||[]).concat(list||[])).shift();\n        if(u === get){\n          if(act.name){ return act.err('Your user account is not published for dApps to access, please consider syncing it online, or allowing local access by adding your device as a peer.') }\n          if(alias && retries--){\n            root.get('~@'+alias).once(act.a);\n            return;\n          }\n          return act.err('Wrong user or password.') \n        }\n        root.get(get).once(act.a);\n      }\n      act.c = function(auth){\n        if(u === auth){ return act.b() }\n        if('string' == typeof auth){ return act.c(obj_ify(auth)) } // in case of legacy\n        SEA.work(pass, (act.auth = auth).s, act.d, act.enc); // the proof of work is evidence that we've spent some time/effort trying to log in, this slows brute force.\n      }\n      act.d = function(proof){\n        SEA.decrypt(act.auth.ek, proof, act.e, act.enc);\n      }\n      act.e = function(half){\n        if(u === half){\n          if(!act.enc){ // try old format\n            act.enc = {encode: 'utf8'};\n            return act.c(act.auth);\n          } act.enc = null; // end backwards\n          return act.b();","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/amark/gun/blob/552227599d47ba0493824b7fcf8a00c8cd6404ba/sea/auth.js#L21-L57","documentation":"In gun.user.auth, after resolving the alias to a user pub key (act.b), the graph is queried for that pub node. If the returned key is undefined (u === get) — meaning the alias→pub lookup found no matching account — and there are no retries or alias left, auth fails with 'Wrong user or password.'","triggerScenarios":"user.auth(alias, password) where the alias was never registered (root.get('~@'+alias) resolves to nothing) or the password is incorrect so proof matching fails; retries counter exhausted after repeated alias lookups; calling auth against a gun instance/graph that does not contain the account.","commonSituations":"Typo in the alias; authenticating before user.create completed/replicated to the connected peers; connecting to a different gun storage/peer set than where the account was created; case-sensitivity differences in the alias.","solutions":["Verify the alias was created via gun.user().create(alias, pass) and completed (ack without err)","Ensure the app is connected to the same peers/storage where the account exists","Check the alias spelling and casing exactly matches the registered one","Handle the ack.err callback to surface the message instead of letting auth fail silently"],"exampleFix":"// before\ngun.user().auth(alias, pass);\n// after\ngun.user().auth(alias, pass, ack => {\n  if (ack.err) {\n    console.error('auth failed:', ack.err); // 'Wrong user or password.'\n    return;\n  }\n  console.log('logged in as', gun.user().is.alias);\n});","handlingStrategy":"try-catch","validationCode":"gun.get('~@' + alias).once(v => {\n  if (!v) console.warn('alias not registered on this graph');\n});","typeGuard":null,"tryCatchPattern":"gun.user().auth(alias, pass, ack => {\n  if (ack && /Wrong user or password/.test(ack.err)) {\n    // prompt user to re-enter credentials / check alias\n    return;\n  }\n  if (ack && ack.err) { console.error(ack.err); return; }\n});","preventionTips":["Always pass the ack callback to auth and surface ack.err","Verify account creation succeeded and replicated before auth","Double-check alias spelling/casing","Confirm you connect to the same peers/storage as registration"],"tags":["sea","auth","gun","credentials"],"backgroundTag":"wrong-credentials","analyzedSha":"552227599d47ba0493824b7fcf8a00c8cd6404ba","analyzedAt":"2026-09-02T18:40:58.370Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}