@xboxreplay/xboxlive-auth
Advanced tools
Comparing version 4.0.0-beta.1 to 4.0.0-beta.2
@@ -1,5 +0,5 @@ | ||
import { LiveAuthResponse, LiveCredentials, LivePreAuthResponse } from '../..'; | ||
import { LiveAuthResponse, LiveCredentials, LivePreAuthResponse, PreAuthOptions } from '../..'; | ||
export declare const getAuthorizeUrl: (clientId?: string, scope?: string, responseType?: 'token' | 'code', redirectUri?: string) => string; | ||
export declare const refreshAccessToken: (refreshToken: string, clientId?: string, scope?: string, clientSecret?: string | undefined) => Promise<LiveAuthResponse>; | ||
export declare const preAuth: () => Promise<LivePreAuthResponse>; | ||
export declare const preAuth: (options?: PreAuthOptions | undefined) => Promise<LivePreAuthResponse>; | ||
export declare const authenticate: (credentials: LiveCredentials) => Promise<LiveAuthResponse>; |
@@ -82,5 +82,5 @@ "use strict"; | ||
exports.refreshAccessToken = refreshAccessToken; | ||
const preAuth = () => __awaiter(void 0, void 0, void 0, function* () { | ||
const preAuth = (options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield axios_1.default({ | ||
url: exports.getAuthorizeUrl(), | ||
url: exports.getAuthorizeUrl(options === null || options === void 0 ? void 0 : options.clientId, options === null || options === void 0 ? void 0 : options.scope, options === null || options === void 0 ? void 0 : options.responseType, options === null || options === void 0 ? void 0 : options.redirectUri), | ||
method: 'GET', | ||
@@ -87,0 +87,0 @@ headers: utils_1.getBaseHeaders() |
@@ -21,2 +21,8 @@ export declare type LiveCredentials = { | ||
}; | ||
export declare type PreAuthOptions = { | ||
clientId?: string; | ||
scope?: string; | ||
responseType?: 'token' | 'code'; | ||
redirectUri?: string; | ||
}; | ||
export declare type XBLExchangeRpsTicketResponse = { | ||
@@ -92,2 +98,3 @@ IssueInstant: string; | ||
export declare const live: { | ||
preAuth: (options?: PreAuthOptions | undefined) => Promise<LivePreAuthResponse>; | ||
getAuthorizeUrl: (clientId?: string, scope?: string, responseType?: "code" | "token", redirectUri?: string) => string; | ||
@@ -94,0 +101,0 @@ authenticate: (credentials: LiveCredentials) => Promise<LiveAuthResponse>; |
@@ -57,2 +57,3 @@ "use strict"; | ||
exports.live = { | ||
preAuth: live_1.preAuth, | ||
getAuthorizeUrl: live_1.getAuthorizeUrl, | ||
@@ -59,0 +60,0 @@ authenticate: live_1.authenticate, |
@@ -23,2 +23,33 @@ # Methods | ||
### Method: preAuth | ||
Pre-authentication request used to retrieve mandatory authentication parameters. | ||
```javascript | ||
import { live } from '@xboxreplay/xboxlive-auth'; | ||
const preAuthResponse = await live.preAuth(); | ||
console.log(preAuthResponse); | ||
``` | ||
##### Arguments | ||
- options {object=} | ||
- clientId {string=} - `000000004C12AE6F` | ||
- scope {string=} - `service::user.auth.xboxlive.com::MBI_SSL` | ||
- responseType {token|code=} - `token` | ||
- redirectUri {string=} - `https://login.live.com/oauth20_desktop.srf` | ||
##### Sample Response | ||
```javascript | ||
{ | ||
"cookie": "MSA=...; X=...; ...", | ||
"matches": { | ||
"PPFT": "abcde...", | ||
"urlPost": "https://login.live.com/..." | ||
} | ||
} | ||
``` | ||
## Namespace: xbl | ||
@@ -57,2 +88,15 @@ | ||
##### Sample Response | ||
```javascript | ||
{ | ||
"IssueInstant": "2021-01-14T18:55:20.0082007Z", | ||
"NotAfter": "2021-01-15T10:55:20.0082007Z", | ||
"Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", | ||
"DisplayClaims": { | ||
"xui": [{ "uhs": "3218841136841218711" }] | ||
} | ||
} | ||
``` | ||
### Method: exchangeTokenForXSTSToken | ||
@@ -89,2 +133,23 @@ | ||
##### Sample Response | ||
```javascript | ||
{ | ||
"IssueInstant": "2021-01-14T18:55:20.0082007Z", | ||
"NotAfter": "2021-01-15T10:55:20.0082007Z", | ||
"Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", | ||
"DisplayClaims": { | ||
"xui": [{ | ||
"gtg": "Zeny IC", | ||
"xid": "2584878536129841", | ||
"uhs": "3218841136841218711" | ||
"agg": "Adult", | ||
"usr" "234", | ||
"utr": "190", | ||
"prv": "185 186 187 188 191 192 ..." | ||
}] | ||
} | ||
} | ||
``` | ||
### Method: exchangeTokensForXSTSToken | ||
@@ -131,2 +196,23 @@ | ||
##### Sample Response | ||
```javascript | ||
{ | ||
"IssueInstant": "2021-01-14T18:55:20.0082007Z", | ||
"NotAfter": "2021-01-15T10:55:20.0082007Z", | ||
"Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", | ||
"DisplayClaims": { | ||
"xui": [{ | ||
"gtg": "Zeny IC", | ||
"xid": "2584878536129841", | ||
"uhs": "3218841136841218711" | ||
"agg": "Adult", | ||
"usr" "234", | ||
"utr": "190", | ||
"prv": "185 186 187 188 191 192 ..." | ||
}] | ||
} | ||
} | ||
``` | ||
### Method: EXPERIMENTAL_createDummyWin32DeviceToken | ||
@@ -159,2 +245,8 @@ | ||
##### Sample Response | ||
``` | ||
https://login.live.com/oauth20_authorize.srf?client_id=000000004C12AE6F&redirect_uri=https://login.live.com/oauth20_desktop.srf&response_type=token&scope=service::user.auth.xboxlive.com::MBI_SSL | ||
``` | ||
### Method: refreshAccessToken | ||
@@ -179,2 +271,15 @@ | ||
##### Sample Response | ||
```javascript | ||
{ | ||
"token_type": "bearer", | ||
"expires_in": 86400, | ||
"access_token": "EwAIA+pvBAAUK...", // RpsTicket | ||
"refresh_token": "M.R3_BAY...", | ||
"scope": "service::user.auth.xboxlive.com::MBI_SSL", | ||
"user_id": "123abc..." | ||
} | ||
``` | ||
### Method: authenticate | ||
@@ -200,1 +305,14 @@ | ||
- password {string} | ||
##### Sample Response | ||
```javascript | ||
{ | ||
"token_type": "bearer", | ||
"expires_in": 86400, | ||
"access_token": "EwAIA+pvBAAUK...", // RpsTicket | ||
"refresh_token": "M.R3_BAY...", | ||
"scope": "service::user.auth.xboxlive.com::MBI_SSL", | ||
"user_id": "123abc..." | ||
} | ||
``` |
{ | ||
"name": "@xboxreplay/xboxlive-auth", | ||
"description": "A light but advanced Xbox Live authentication module with OAuth2.0 and Electron support", | ||
"version": "4.0.0-beta.1", | ||
"version": "4.0.0-beta.2", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "xboxreplay", |
@@ -8,3 +8,3 @@ # @xboxreplay/xboxlive-auth | ||
```shell | ||
$ npm install @xboxreplay/xboxlive-auth@4.0.0-beta.0 | ||
$ npm install @xboxreplay/xboxlive-auth@4.0.0-beta.2 | ||
``` | ||
@@ -15,6 +15,5 @@ | ||
```javascript | ||
import xboxliveAuth from '@xboxreplay/xboxlive-auth'; | ||
import { authenticate } from '@xboxreplay/xboxlive-auth'; | ||
xboxliveAuth | ||
.authenticate('name@domain.com', '*********') | ||
authenticate('name@domain.com', '*********') | ||
.then(console.info) | ||
@@ -21,0 +20,0 @@ .catch(console.error); |
56089
675
78