{"id":18777,"library":"screepsmod-auth","title":"screepsmod-auth","description":"Screepsmod-auth is a mod for the Screeps private server that adds user/password authentication, enabling login via the API and web form. Version 2.8.2 is current, with low release cadence. It supports password setting via Steam client, server CLI, and GitHub OAuth. Configurable initial CPU and spawn blocking. Differentiates from default Steam-only auth by allowing custom credentials and GitHub login.","status":"active","version":"2.8.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","screeps","mod"],"install":[{"cmd":"npm install screepsmod-auth","lang":"bash","label":"npm"},{"cmd":"yarn add screepsmod-auth","lang":"bash","label":"yarn"},{"cmd":"pnpm add screepsmod-auth","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for mod integration with Screeps backend","package":"@screeps/backend","optional":false}],"imports":[{"note":"authUser is a named export, not default. Used in config.auth.authUser.","wrong":"import authUser from 'screepsmod-auth'","symbol":"authUser","correct":"import { authUser } from 'screepsmod-auth'"},{"note":"ESM import; CommonJS require pattern still works but ESM is preferred.","wrong":"const setPassword = require('screepsmod-auth').setPassword","symbol":"setPassword","correct":"import { setPassword } from 'screepsmod-auth'"},{"note":"config is a named export, not default.","wrong":"import { default as config } from 'screepsmod-auth'","symbol":"config","correct":"import { config } from 'screepsmod-auth'"}],"quickstart":{"code":"import { setPassword } from 'screepsmod-auth';\n\n// Via CLI: npx screeps cli\n// Then run: setPassword('Username', 'YourDesiredPassword')\n\n// Or in server config:\nimport { config } from 'screepsmod-auth';\nconfig.auth.authUser = async (username, password) => {\n  // custom auth logic\n  return username === 'admin' && password === 'secret' ? { username } : false;\n};","lang":"typescript","description":"Shows basic usage: set a password via CLI, and configure custom authUser function."},"warnings":[{"fix":"Use named imports: import { setPassword, authUser, config } from 'screepsmod-auth'","message":"Removed default export in v2; only named exports available.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use ES module imports: import { ... } from 'screepsmod-auth'","message":"CommonJS require() still works but ESM is recommended for future compatibility.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Open Steam client once to create initial account before setting password via web.","message":"Passwords set via web form require Steam client initial account creation first.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set callback URL to /api/auth/github/return on your server, e.g., https://screeps.mydomain.com/api/auth/github/return","message":"GitHub OAuth callback URL must exactly match the registered callback on GitHub.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use environment variables GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, etc.","message":"The .screepsrc ini config is deprecated in favor of environment variables.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install screepsmod-auth' in your server folder","cause":"Module not installed or wrong path","error":"Error: Cannot find module 'screepsmod-auth'"},{"fix":"Use 'import { setPassword } from 'screepsmod-auth''","cause":"Importing setPassword incorrectly (e.g., default import instead of named)","error":"TypeError: setPassword is not a function"},{"fix":"Ensure callback URL ends with '/api/auth/github/return' and matches exactly","cause":"Callback URL does not match GitHub app configuration","error":"Error: Github OAuth callback URL mismatch"},{"fix":"Set 'preventSpawning = false' in [auth] config or whitelist user","cause":"preventSpawning set to true in config and user not whitelisted","error":"Error: spawn placement blocked"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}