{"name":"@xboxreplay/xboxlive-auth","version":"5.0.0-beta.4","keywords":["xboxnetwork","xboxreplay","xboxlive","xbox","live","auth"],"author":{"name":"Alexis Bize","email":"alexis.bize@gmail.com"},"license":"Apache-2.0","_id":"@xboxreplay/xboxlive-auth@5.0.0-beta.4","maintainers":[{"name":"zeny","email":"alexis.bize@gmail.com"}],"homepage":"https://github.com/XboxReplay/xboxlive-auth#readme","bugs":{"url":"https://github.com/XboxReplay/xboxlive-auth/issues"},"dist":{"shasum":"eb8f47dfc8c885cc89046e6596bcb853102d3159","tarball":"http://registry-npm.ywwl.com/@xboxreplay/xboxlive-auth/download/@xboxreplay/xboxlive-auth-5.0.0-beta.4.tgz","fileCount":41,"integrity":"sha512-LEklC8LBj8RQw1woGBIlG5+a0NQ9w56R1TRixh9sU30HDDq7L0tWbpycueMjlpBXChg0/JZRjp5wjWZrWYJqFA==","signatures":[{"sig":"MEQCIC8PHOjQUqwJlRkZkG86jr12PCe6p9eQ6miW87zlbpDVAiBNgqigYyqL8SmfMdziqlgvrN0Ora8Eltr5z5WDGmqyig==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":112964,"size":22718,"noattachment":false,"key":"/@xboxreplay/xboxlive-auth/-/@xboxreplay/xboxlive-auth-5.0.0-beta.4.tgz"},"jest":{"preset":"ts-jest/presets/default-esm","testMatch":["**/?(*.)+(spec|test).ts"],"transform":{"^.+\\.ts$":["ts-jest",{"useESM":true,"isolatedModules":true}]},"testEnvironment":"node","moduleNameMapper":{"^src/(.*)$":"<rootDir>/src/$1"},"moduleFileExtensions":["ts","js"],"extensionsToTreatAsEsm":[".ts"]},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"24e7af381d4347af022f8445e784300f6c83fd6b","scripts":{"test":"npm run test:integration && npm run test:e2e","build":"npm run clean && tsc","clean":"rimraf ./dist","test:e2e":"touch .env.test && dotenv -e .env.test -- jest --runInBand ./tests/e2e","typecheck":"tsc --noEmit","prepublishOnly":"npm run test && npm run build","test:integration":"jest --runInBand ./tests/integration"},"_npmUser":{"name":"zeny","email":"alexis.bize@gmail.com"},"deprecated":"Test - Do not use","repository":{"url":"git+https://github.com/XboxReplay/xboxlive-auth.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight, zero-dependency Xbox Network (Xbox Live) authentication library for Node.js with OAuth 2.0 support.","directories":{},"sideEffects":false,"_nodeVersion":"22.13.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"29.7.0","rimraf":"6.0.1","ts-jest":"29.2.5","dotenv-cli":"8.0.0","typescript":"5.8.3","@types/jest":"29.5.14","@types/node":"22.15.18"},"_npmOperationalInternal":{"tmp":"tmp/xboxlive-auth_5.0.0-beta.4_1748347893751_0.7689087290202425","host":"s3://npm-registry-packages-npm-production"},"readme":"# XboxReplay/XboxLive-Auth\n\nA lightweight, zero-dependency Xbox Network (Xbox Live) authentication library for Node.js with OAuth 2.0 support.\n\n⚠️ **Breaking Changes Notice**: Significant breaking changes have been introduced since v4. Please review the [Migration Guide](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/90-Migration_From_v4.md) for detailed upgrade instructions and code examples.\n\n> [!IMPORTANT]\n> The main `authenticate()` function remains backward compatible for basic usage, but method imports and advanced features have changed significantly.\n\n## Installation\n\n```bash\nnpm install @xboxreplay/xboxlive-auth\n```\n\n## Quick Start\n\n### Basic Authentication\n\n```typescript\nimport { authenticate } from '@xboxreplay/xboxlive-auth';\n\nauthenticate('name@domain.com', 'password').then(console.info).catch(console.error);\n```\n\n### Response Format\n\n```json\n{\n  \"xuid\": \"2584878536129841\",\n  \"user_hash\": \"3218841136841218711\",\n  \"xsts_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\",\n  \"display_claims\": {\n    \"gtg\": \"Zeny IC\",\n    \"xid\": \"2584878536129841\",\n    \"uhs\": \"3218841136841218711\",\n    \"agg\": \"Adult\",\n    \"usr\": \"234\",\n    \"utr\": \"190\",\n    \"prv\": \"185 186 187 188 191 192 ...\"\n  },\n  \"expires_on\": \"2025-04-13T05:43:32.6275675Z\"\n}\n```\n\n> [!NOTE]\n> The `xuid` field may be null based on the specified \"RelyingParty\", and `display_claims` may vary based on the specified \"RelyingParty\" configuration.\n\n### Advanced Usage\n\n#### Raw Response Mode\n\n```typescript\nimport { authenticate } from '@xboxreplay/xboxlive-auth';\n\n// Get raw responses from all authentication steps\nconst rawResponse = await authenticate('email@example.com', 'password', {\n  raw: true,\n});\n\nconsole.log(rawResponse);\n// Returns:\n// {\n//   'login.live.com': LiveAuthResponse,\n//   'user.auth.xboxlive.com': XNETExchangeRpsTicketResponse,\n//   'xsts.auth.xboxlive.com': XNETExchangeTokensResponse\n// }\n```\n\n#### Custom Authentication Options\n\n```typescript\nimport { authenticate } from '@xboxreplay/xboxlive-auth';\n\nconst result = await authenticate('email@example.com', 'password', {\n  XSTSRelyingParty: 'http://xboxlive.com',\n  optionalDisplayClaims: ['gtg', 'xid'],\n  sandboxId: 'RETAIL',\n});\n```\n\n### Using Individual Modules\n\nThe library now exports granular modules for advanced use cases:\n\n```typescript\nimport { live, xnet } from '@xboxreplay/xboxlive-auth';\n\n// Microsoft Live authentication\nawait live.preAuth();\nawait live.authenticateWithCredentials({ email: 'user@example.com', password: 'password' });\nawait live.exchangeCodeForAccessToken(code);\nawait live.refreshAccessToken(refreshToken);\n\n// Xbox Network token exchange\nawait xnet.exchangeRpsTicketForUserToken(accessToken, 't');\nawait xnet.exchangeTokensForXSTSToken(tokens, options);\n\n// Experimental features\nconst deviceToken = await xnet.experimental.createDummyWin32DeviceToken();\n```\n\n## Type Safety\n\nThe library is fully typed with TypeScript. Key types include:\n\n-   `Email`: Enforces proper email format (`${string}@${string}.${string}`)\n-   `AuthenticateOptions`: Configuration options for authentication\n-   `AuthenticateResponse`: Standard response format\n-   `AuthenticateRawResponse`: Raw response format when `raw: true`\n\n## Documentation\n\n-   [Basic authentication](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/01-Authenticate.md)\n-   [Use a custom Azure Application (OAuth2.0)](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/02-Custom_Azure_Application.md)\n-   [Experimental methods, such as \"deviceToken\" generation](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/03-Experimental.md)\n-   [What's a RelyingParty and how to use it](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/04-RelyingParty.md)\n-   [Available methods in this library](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/05-Methods.md)\n-   [Known issues and possible workarounds](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/06-Known_Issues.md)\n-   [How to deal with unauthorized \"AgeGroup\" authentication](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/07-Detect_Unauthorized_AgeGroup.md)\n\n## Using the XSAPI Client\n\nThe library includes an XSAPI client that's a Fetch wrapper designed specifically for calling Xbox Network APIs:\n\n```typescript\nawait XSAPIClient.get('https://profile.xboxlive.com/users/gt(Major%20Nelson)/profile/settings?settings=Gamerscore', {\n  options: { contractVersion: 2, userHash: 'YOUR_USER_HASH', XSTSToken: 'YOUR_XSTS_TOKEN' },\n});\n```\n\n### Manual cURL Example\n\n```bash\ncurl 'https://profile.xboxlive.com/users/gt(Major%20Nelson)/profile/settings?settings=Gamerscore' \\\n  -H 'Authorization: XBL3.0 x=YOUR_USER_HASH;YOUR_XSTS_TOKEN' \\\n  -H 'X-XBL-Contract-Version: 2'\n```\n\n## Known Limitations\n\n### Two-Factor Authentication (2FA)\n\nThe exposed `authenticate` method cannot deal with 2FA, but a workaround may be possible using OAuth2.0 flows with refresh tokens. Please take a look at the [authenticate documentation](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/01-Authenticate.md). Additional improvements regarding this issue are not currently planned.\n\n### Other Issues\n\nPlease refer to the [dedicated documentation](https://github.com/XboxReplay/xboxlive-auth/blob/master/docs/06-Known_Issues.md) for other known issues and workarounds.\n\n## License\n\n[Apache Version 2.0](https://github.com/XboxReplay/xboxlive-auth/blob/master/LICENSE)\n","publish_time":1748347893963,"_cnpm_publish_time":1748347893963,"dist-tags":{"beta":"5.0.0-beta.4","latest":"5.1.0"}}