bun-launcher-app-client-2
v1.0.0
Published
`bun-launcher-app-client-2` creates a basic `LauncherAppClient2` client, handling authentication with `LauncherAppClient2.login()`. Subsequent `LauncherAppClient2.fetch()` calls will automatically assign the correct `Authorization` and `User-Agent` header
Readme
bun-launcher-app-client-2 creates a basic LauncherAppClient2 client, handling
authentication with LauncherAppClient2.login(). Subsequent LauncherAppClient2.fetch() calls will
automatically assign the correct Authorization and User-Agent headers.
𝐢 · Use bun-fortnite-android-game-client to easily get an ExchangeCode.
Installation
bun add bun-launcher-app-client-2Example
import type { ExchangeCode } from 'bun-launcher-app-client-2';
import LauncherAppClient2 from 'bun-launcher-app-client-2';
// Create a LauncherAppClient2 client…
const launcherAppClient2 = new LauncherAppClient2();
// Login with the LauncherAppClient2 client using an ExchangeCode…
await launcherAppClient2.login({
code: '…',
});
// Request an AccountQuery with the LauncherAppClient2 client…
const accountQuery = await launcherAppClient2
.fetch('https://graphql.epicgames.com/graphql', {
body: JSON.stringify({
operationName: 'AccountQuery',
query: 'query AccountQuery($displayName:String){Account{account(displayName:$displayName){displayName externalAuths{accountId externalAuthId externalDisplayName type}friendshipStatus id}}}', // prettier-ignore
variables: { displayName: 'Mew Mew Uwu' },
}),
headers: { 'Content-Type': 'application/json' },
method: 'POST',
})
.then((response) => response.json());
// Log the results…
console.dir(accountQuery, { depth: Infinity });
// Request an ExchangeCode with the LauncherAppClient2 client…
const exchangeCode = await launcherAppClient2
.fetch('https://account-public-service-prod.ol.epicgames.com/account/api/oauth/exchange')
.then((response) => response.json());
// Log the results…
console.dir(exchangeCode, { depth: Infinity });