@xboxreplay/xboxlive-auth
Advanced tools
Comparing version 0.0.3 to 0.1.0
@@ -1,2 +0,4 @@ | ||
import { IAuthUserResponse, IAuthOptions } from './__typings__'; | ||
import { IExchangeUserTokenResponse, IAuthUserResponse, IAuthOptions } from './__typings__'; | ||
export declare const exchangeAccessTokenForUserToken: (accessToken: string) => Promise<string>; | ||
export declare const exchangeUserTokenForXSTSIdentity: (userToken: string, XSTSRelyingParty?: string) => Promise<IExchangeUserTokenResponse>; | ||
export declare const authenticate: (email: string, password: string, options?: IAuthOptions) => Promise<IAuthUserResponse>; |
@@ -98,7 +98,8 @@ "use strict"; | ||
}); | ||
const _exchangeAccessTokenForUserToken = (accessToken) => new Promise((resolve, reject) => { | ||
// ***** PUBLIC METHODS ***** // | ||
exports.exchangeAccessTokenForUserToken = (accessToken) => new Promise((resolve, reject) => { | ||
request({ | ||
uri: __typings__1.XboxLiveEndpoints.UserAuthenticate, | ||
method: 'POST', | ||
headers: BASE_HEADERS, | ||
headers: Object.assign({}, BASE_HEADERS, { 'x-xbl-contract-version': 0 }), | ||
json: { | ||
@@ -121,7 +122,7 @@ RelyingParty: 'http://auth.xboxlive.com', | ||
}); | ||
const _exchangeUserTokenForXSTSIdentity = (userToken, XSTSRelyingParty = 'http://xboxlive.com') => new Promise((resolve, reject) => { | ||
exports.exchangeUserTokenForXSTSIdentity = (userToken, XSTSRelyingParty = 'http://xboxlive.com') => new Promise((resolve, reject) => { | ||
request({ | ||
uri: __typings__1.XboxLiveEndpoints.XSTSAuthorize, | ||
method: 'POST', | ||
headers: BASE_HEADERS, | ||
headers: Object.assign({}, BASE_HEADERS, { 'x-xbl-contract-version': 0 }), | ||
json: { | ||
@@ -146,8 +147,7 @@ RelyingParty: XSTSRelyingParty, | ||
}); | ||
// ***** PUBLIC METHODS ***** // | ||
exports.authenticate = (email, password, options = {}) => __awaiter(this, void 0, void 0, function* () { | ||
const preAuthResponse = yield _preAuth(); | ||
const logUser = yield _logUser(preAuthResponse, { email, password }); | ||
const userToken = yield _exchangeAccessTokenForUserToken(logUser.accessToken); | ||
return _exchangeUserTokenForXSTSIdentity(userToken, options.XSTSRelyingParty); | ||
const userToken = yield exports.exchangeAccessTokenForUserToken(logUser.accessToken); | ||
return exports.exchangeUserTokenForXSTSIdentity(userToken, options.XSTSRelyingParty); | ||
}); |
{ | ||
"name": "@xboxreplay/xboxlive-auth", | ||
"description": "Simple Xbox Live authentication module.", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"keywords": ["xboxreplay", "xboxlive", "auth"], | ||
"types": "./dist/index.d.ts", | ||
"repository": { | ||
@@ -7,0 +8,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14701
263