{"_id":"@autolabz/auth-sdk","_rev":"6-33e28576e942f96f3f6f55523651c8cb","name":"@autolabz/auth-sdk","dist-tags":{"latest":"1.1.5"},"versions":{"1.0.0":{"name":"@autolabz/auth-sdk","version":"1.0.0","keywords":["react","auth","sso","authentication","sdk"],"author":{"name":"AutoLab Team"},"license":"MIT","_id":"@autolabz/auth-sdk@1.0.0","maintainers":[{"name":"autolabz","email":"mzhh@mzhh.xyz"}],"dist":{"shasum":"af74265269d8f6de7006b822f0e4de2a16e4315c","tarball":"https://registry.npmjs.org/@autolabz/auth-sdk/-/auth-sdk-1.0.0.tgz","fileCount":15,"integrity":"sha512-23OGsbj+MZzp6+1CqOJWqh74jT3Gdp6+zgrlgIRKkLwsi9L4MECsyW6W+PBHOJmDBmtZ92YzPEuY30hkR++ZWA==","signatures":[{"sig":"MEUCIQD1tpMsFrxELiCoTuRzydlQRjejt9uTnhVGXQoHMJGYLwIgIVbzh+gvtJa9M6xvcEaj9FteSjQJz+HfPrl+kOB/HpY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":154255},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"4293308e7e812a7b3fdd7b1e9c75c8ea30f85dde","scripts":{"dev":"vite build --watch","lint":"eslint . --ext ts,tsx","test":"vitest run --passWithNoTests","build":"tsc && vite build","lint:fix":"eslint . --ext ts,tsx --fix","prepublishOnly":"npm run build && npm test -if-present"},"_npmUser":{"name":"autolabz","email":"mzhh@mzhh.xyz"},"_npmVersion":"10.8.2","description":"AutoLab 认证 SDK - React 组件库","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"axios":"^1.6.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.11","react":"^18.2.0","eslint":"^8.56.0","vitest":"^1.1.1","react-dom":"^18.2.0","typescript":"^5.3.3","@types/react":"^18.2.47","vite-plugin-dts":"^3.7.0","@types/react-dom":"^18.2.18","@vitejs/plugin-react":"^4.2.1","@typescript-eslint/parser":"^6.16.0","@typescript-eslint/eslint-plugin":"^6.16.0"},"peerDependencies":{"react":"^18.0.0","react-dom":"^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-sdk_1.0.0_1760693197203_0.5268068881416923","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@autolabz/auth-sdk","version":"1.1.1","keywords":["react","auth","sso","authentication","sdk"],"author":{"name":"AutoLab Team"},"license":"MIT","_id":"@autolabz/auth-sdk@1.1.1","maintainers":[{"name":"autolabz","email":"mzhh@mzhh.xyz"}],"dist":{"shasum":"6107898623451c0434d859fe62449165068eb1a9","tarball":"https://registry.npmjs.org/@autolabz/auth-sdk/-/auth-sdk-1.1.1.tgz","fileCount":15,"integrity":"sha512-ljztq3YLHcdVHVaq5H4QTsNcdKqLuu0czbQZjsRag0J/mW/lq+eE4vK7hPFJk9K6ZyYwQZTsUjy97PXVAiKuGA==","signatures":[{"sig":"MEUCIH5G3B8FyEyrxwNhr+RGaRltc+dSeH6b/fgr9V/EWwUBAiEAsg7QVifjHuriAXE7FK+/y8jEKyQvb9na6NGIXNFSBD0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":154278},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"4293308e7e812a7b3fdd7b1e9c75c8ea30f85dde","scripts":{"dev":"vite build --watch","lint":"eslint . --ext ts,tsx","test":"vitest run --passWithNoTests","build":"tsc && vite build","lint:fix":"eslint . --ext ts,tsx --fix","prepublishOnly":"npm run build && npm test -if-present"},"_npmUser":{"name":"autolabz","email":"mzhh@mzhh.xyz"},"_npmVersion":"10.8.2","description":"AutoLab 认证 SDK - React 组件库","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"axios":"^1.6.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.11","react":"^18.2.0","eslint":"^8.56.0","vitest":"^1.1.1","react-dom":"^18.2.0","typescript":"^5.3.3","@types/react":"^18.2.47","vite-plugin-dts":"^3.7.0","@types/react-dom":"^18.2.18","@vitejs/plugin-react":"^4.2.1","@typescript-eslint/parser":"^6.16.0","@typescript-eslint/eslint-plugin":"^6.16.0"},"peerDependencies":{"react":"^18.0.0","react-dom":"^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-sdk_1.1.1_1760698921975_0.2740632799173348","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@autolabz/auth-sdk","version":"1.1.2","keywords":["react","auth","sso","authentication","sdk"],"author":{"name":"AutoLab Team"},"license":"MIT","_id":"@autolabz/auth-sdk@1.1.2","maintainers":[{"name":"autolabz","email":"mzhh@mzhh.xyz"}],"dist":{"shasum":"a766a90d90001289e6d0f23153b5c4619b42dec5","tarball":"https://registry.npmjs.org/@autolabz/auth-sdk/-/auth-sdk-1.1.2.tgz","fileCount":15,"integrity":"sha512-fPuZuiht3riG5BAJYQZI6pLsLysdUL4+KItBxFgT65DorIXnvyzZ+r8dT6p3wRdIYEdU9u5nOilg1w0YP8E7Ow==","signatures":[{"sig":"MEQCIGdeN3cMrJglQheuWeOyGgcEkp8xH69kel4mqj2WBCAzAiAKNKH7AsXWDYTQ+3uUx6+kBlUuQWsONDX/onyesBaM1A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":154262},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"4293308e7e812a7b3fdd7b1e9c75c8ea30f85dde","scripts":{"dev":"vite build --watch","lint":"eslint . --ext ts,tsx","test":"vitest run --passWithNoTests","build":"tsc && vite build","lint:fix":"eslint . --ext ts,tsx --fix","prepublishOnly":"npm run build && npm test -if-present"},"_npmUser":{"name":"autolabz","email":"mzhh@mzhh.xyz"},"_npmVersion":"10.8.2","description":"AutoLab 认证 SDK - React 组件库","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"axios":"^1.6.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.11","react":"^18.2.0","eslint":"^8.56.0","vitest":"^1.1.1","react-dom":"^18.2.0","typescript":"^5.3.3","@types/react":"^18.2.47","vite-plugin-dts":"^3.7.0","@types/react-dom":"^18.2.18","@vitejs/plugin-react":"^4.2.1","@typescript-eslint/parser":"^6.16.0","@typescript-eslint/eslint-plugin":"^6.16.0"},"peerDependencies":{"react":"^18.0.0","react-dom":"^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-sdk_1.1.2_1760700652491_0.2914042741353684","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@autolabz/auth-sdk","version":"1.1.3","keywords":["react","auth","sso","authentication","sdk"],"author":{"name":"AutoLab Team"},"license":"MIT","_id":"@autolabz/auth-sdk@1.1.3","maintainers":[{"name":"autolabz","email":"mzhh@mzhh.xyz"}],"dist":{"shasum":"ef41eccc428ecd3fe92cb7415108b602ae9dafc0","tarball":"https://registry.npmjs.org/@autolabz/auth-sdk/-/auth-sdk-1.1.3.tgz","fileCount":15,"integrity":"sha512-JP1g6yy3xvcYHxCb+q7+VzWo7RHRkVA8ZllGYmp0Of4YEL21GOJYhu84HRYSQLwC862RDThE9yeuM6BVxFd4Ng==","signatures":[{"sig":"MEUCIQC9HeMHlYDp7khpNHOVC/l/lP0UpL/C8ctQvfKWiKuo2AIgA9xdzYAepnhTSdxYnD+asNnVWGudywxuHBEMcnS5ZkE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":119630},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"5bce87ba3e45534289b0bdf8c2165f9c84f58b25","scripts":{"dev":"vite build --watch","lint":"eslint . --ext ts,tsx","test":"vitest run --passWithNoTests","build":"tsc && vite build","lint:fix":"eslint . --ext ts,tsx --fix","prepublishOnly":"npm run build && npm test -if-present"},"_npmUser":{"name":"autolabz","email":"mzhh@mzhh.xyz"},"_npmVersion":"10.8.2","description":"AutoLab 认证 SDK - React 组件库","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"axios":"^1.6.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.11","react":"^18.2.0","eslint":"^8.56.0","vitest":"^1.1.1","react-dom":"^18.2.0","typescript":"^5.3.3","@types/react":"^18.2.47","vite-plugin-dts":"^3.7.0","@types/react-dom":"^18.2.18","@vitejs/plugin-react":"^4.2.1","@typescript-eslint/parser":"^6.16.0","@typescript-eslint/eslint-plugin":"^6.16.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-sdk_1.1.3_1761188412912_0.5057419782379533","host":"s3://npm-registry-packages-npm-production"}},"1.1.4":{"name":"@autolabz/auth-sdk","version":"1.1.4","keywords":["react","auth","sso","authentication","sdk"],"author":{"name":"AutoLab Team"},"license":"MIT","_id":"@autolabz/auth-sdk@1.1.4","maintainers":[{"name":"autolabz","email":"mzhh@mzhh.xyz"}],"dist":{"shasum":"1efdfa3c5454d03ecc7e6f4c69458bb494a45362","tarball":"https://registry.npmjs.org/@autolabz/auth-sdk/-/auth-sdk-1.1.4.tgz","fileCount":15,"integrity":"sha512-9Nk0RuhKKjPv9InjdDzz30tjmOG6eh6LDwPgi6BHqBiVKlwsZj6O19A03vEsM0Bd4vFxhTlz6Tvl3KB2Q2uGPQ==","signatures":[{"sig":"MEQCIGQWY8+SNPvxaP5zi/rAy6VKpfI21zj2ZPbXeBHNdc0WAiAwf9HpoIOYDIhYsCJVKzZKA1OutM+c8nvpcN7+D5H86A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":120622},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"93935a6d544bf8cc249d07c95a7f15c6c9c8ed88","scripts":{"dev":"vite build --watch","lint":"eslint . --ext ts,tsx","test":"vitest run --passWithNoTests","build":"tsc && vite build","lint:fix":"eslint . --ext ts,tsx --fix","prepublishOnly":"npm run build && npm test -if-present"},"_npmUser":{"name":"autolabz","email":"mzhh@mzhh.xyz"},"_npmVersion":"10.8.2","description":"AutoLab 认证 SDK - React 组件库","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"axios":"^1.6.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.11","react":"^18.2.0","eslint":"^8.56.0","vitest":"^1.1.1","react-dom":"^18.2.0","typescript":"^5.3.3","@types/react":"^18.2.47","vite-plugin-dts":"^3.7.0","@types/react-dom":"^18.2.18","@vitejs/plugin-react":"^4.2.1","@typescript-eslint/parser":"^6.16.0","@typescript-eslint/eslint-plugin":"^6.16.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-sdk_1.1.4_1761299491573_0.24682957777879433","host":"s3://npm-registry-packages-npm-production"}},"1.1.5":{"name":"@autolabz/auth-sdk","version":"1.1.5","description":"AutoLab 认证 SDK - React 组件库","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","publishConfig":{"access":"public"},"sideEffects":false,"scripts":{"dev":"vite build --watch","build":"tsc && vite build","prepublishOnly":"npm run build && npm test -if-present","lint":"eslint . --ext ts,tsx","lint:fix":"eslint . --ext ts,tsx --fix","test":"vitest run --passWithNoTests"},"keywords":["react","auth","sso","authentication","sdk"],"author":{"name":"AutoLab Team"},"license":"MIT","peerDependencies":{"react":"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0"},"dependencies":{"axios":"^1.6.5"},"devDependencies":{"@types/react":"^18.2.47","@types/react-dom":"^18.2.18","@typescript-eslint/eslint-plugin":"^6.16.0","@typescript-eslint/parser":"^6.16.0","@vitejs/plugin-react":"^4.2.1","eslint":"^8.56.0","react":"^18.2.0","react-dom":"^18.2.0","typescript":"^5.3.3","vite":"^5.0.11","vite-plugin-dts":"^3.7.0","vitest":"^1.1.1"},"_id":"@autolabz/auth-sdk@1.1.5","gitHead":"2100f007a4759a2b8c9aeb2c2591efcf93d5346f","_nodeVersion":"20.19.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-W0bhbMPgMYMjRHprkb1YbamKzON4Q8CwM8uHTU+lsghg0uxh70QGRJfI8EqK6KztMROTVdi13DVFrwccZUPfdg==","shasum":"c184ebfcd5db4613ce5f25b38c6dd29a1e60174f","tarball":"https://registry.npmjs.org/@autolabz/auth-sdk/-/auth-sdk-1.1.5.tgz","fileCount":19,"unpackedSize":125781,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDHgfkxGkaNaeLGKeP9SWZyt5z2YoUf14wPNbeg4tC8vwIhAM7yMJ4Q7j9Pr52Tp00DdxaNpq+KZcoL6goKgMNQVnBq"}]},"_npmUser":{"name":"autolabz","email":"mzhh@mzhh.xyz"},"directories":{},"maintainers":[{"name":"autolabz","email":"mzhh@mzhh.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/auth-sdk_1.1.5_1763212313812_0.8127005732428059"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-17T09:26:37.131Z","modified":"2025-11-15T13:11:54.228Z","1.0.0":"2025-10-17T09:26:37.406Z","1.1.1":"2025-10-17T11:02:02.159Z","1.1.2":"2025-10-17T11:30:52.718Z","1.1.3":"2025-10-23T03:00:13.114Z","1.1.4":"2025-10-24T09:51:31.771Z","1.1.5":"2025-11-15T13:11:54.034Z"},"author":{"name":"AutoLab Team"},"license":"MIT","keywords":["react","auth","sso","authentication","sdk"],"description":"AutoLab 认证 SDK - React 组件库","maintainers":[{"name":"autolabz","email":"mzhh@mzhh.xyz"}],"readme":"# @autolabz/auth-sdk\n\nAutoLab 认证 SDK - React 组件库\n\n## 📦 安装\n\n```bash\nnpm install @autolabz/auth-sdk\n```\n\n## 🚀 快速开始\n\n### 1. 包裹应用根组件（使用环境变量配置绝对地址）\n\n```tsx\nimport { AuthProvider } from '@autolabz/auth-sdk';\n\nfunction App() {\n  const authServiceUrl = import.meta.env.VITE_AUTH_API_BASE_URL; \n  return (\n    <AuthProvider authServiceUrl={authServiceUrl}>\n      <YourApp />\n    </AuthProvider>\n  );\n}\n```\n\n### 2. 使用 AuthAvatar 组件\n\n```tsx\nimport { AuthAvatar } from '@autolabz/auth-sdk';\n\nfunction Header() {\n  return (\n    <div className=\"header\">\n      <h1>我的应用</h1>\n      <AuthAvatar authPortalUrl={import.meta.env.VITE_OAUTH_PROFILE_URL} />\n    </div>\n  );\n}\n```\n\n### 3. 使用 useAuth Hook\n\n```tsx\nimport { useAuth } from '@autolabz/auth-sdk';\n\nfunction UserInfo() {\n  const { isAuthenticated, user, logout } = useAuth();\n\n  if (!isAuthenticated) {\n    return <div>请登录</div>;\n  }\n\n  return (\n    <div>\n      <p>欢迎, {user.nickname}</p>\n      <button onClick={logout}>退出登录</button>\n    </div>\n  );\n}\n```\n\n## 📚 API 文档\n\n### AuthProvider\n\n| Props | 类型 | 必需 | 描述 |\n|-------|------|------|------|\n| `children` | `ReactNode` | ✅ | 子组件 |\n| `authServiceUrl` | `string` | ✅ | 认证服务 API 基础地址 |\n\n### useAuth Hook\n\n返回值:\n\n```ts\n{\n  isAuthenticated: boolean;\n  user: User | null;\n  login: (user: User, refreshToken: string) => void;\n  logout: () => Promise<void>;\n  refreshAuth: () => void;\n}\n```\n\n### AuthAvatar\n\n| Props | 类型 | 必需 | 描述 |\n|-------|------|------|------|\n| `authPortalUrl` | `string` | ❌ | 认证门户 URL（建议显式传入完整 URL） |\n\n## 🔑 核心特性\n\n- ✅ 自动跨标签页状态同步\n- ✅ LocalStorage 持久化\n- ✅ TypeScript 类型支持\n- ✅ 零配置使用\n- ✅ 样式隔离\n\n## 📝 开发\n\n```bash\n# 安装依赖\nnpm install\n\n# 开发模式\nnpm run dev\n\n# 构建\nnpm run build\n\n# 测试\nnpm test\n```\n\n## 📄 License\n\nMIT\n\n","readmeFilename":"README.md"}