{"record":{"id":"96d0b93570c177bb","repo":"amark/gun","slug":"your-user-account-is-not-published-for-dapps-to-ac","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea/auth.js","lineNumber":34,"sourceCode":"        (cb || noop)({err: Gun.log(\"User is already being created or authenticated!\"), wait: true});\n        return gun;\n      }\n      cat.ing = true;\n      \n      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){","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/amark/gun/blob/552227599d47ba0493824b7fcf8a00c8cd6404ba/sea/auth.js#L16-L52","documentation":"During gun.user.auth, SEA resolves the user's public key by looking up '~@alias'. When the authenticated pair's pub (act.name set) cannot be found in the graph via the fallback peer lookup (get was undefined, u === get), the library reports that the account is not visible to dApps — the user's account data is not published/replicated so the app cannot access it.","triggerScenarios":"Logging in (user.auth) with credentials whose account record exists only on a device not connected as a peer, and the graph lookup for the user's '~' pub node returns nothing (act.list exhausted, get === u) while act.name is set; calling auth against peers that do not have the user's account synced.","commonSituations":"Developing locally with no peers and an account created but never 'synced online'; switching devices without migrating the SEA key pair; firewall/offline environments where the dApp cannot reach the peer holding the account; test environments with isolated gun instances.","solutions":["Add your device as a peer of the node holding the account (gun opt peers) so the account data is reachable","Sync the account online once so '~@alias' and '~pub' data are published to peers","Pass the correct SEA key pair via gun.user().auth(pair) so act.name is set and the local account is used","Verify peer connectivity (gun.opt({peers}) URLs) and that the alias lookup '~@'+alias resolves"],"exampleFix":"// before — isolated gun, no peers, local account invisible\nconst gun = Gun();\ngun.user().auth(alias, pass);\n// after\nconst gun = Gun({ peers: ['https://your-gun-peer.example.com/gun'] });\ngun.user().auth(alias, pass, ack => { if (ack.err) console.error(ack.err); });","handlingStrategy":"fallback","validationCode":"const gun = Gun({ peers: ['https://relay.example.com/gun'] });\ngun.get('~@' + alias).once(data => {\n  if (!data) console.warn('account not published to peers; auth will fail');\n});","typeGuard":"const hasPeers = (g) => Array.isArray(g._.opt && g._.opt.peers) && g._.opt.peers.length > 0;","tryCatchPattern":"gun.user().auth(alias, pass, ack => {\n  if (ack && ack.err) {\n    if (String(ack.err).includes('not published')) {\n      // add peer / sync account, then retry auth\n    }\n    return;\n  }\n});","preventionTips":["Configure reachable peers so accounts replicate","Sync the account online once after create","Keep the SEA key pair on the devices you auth from","Test auth in an environment mirroring production peer topology"],"tags":["sea","auth","gun","peers","sync"],"backgroundTag":"gun-user-not-published","analyzedSha":"552227599d47ba0493824b7fcf8a00c8cd6404ba","analyzedAt":"2026-09-02T18:40:58.370Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}