Mojang Module
This is a sub-module belong to minecraft-launcher-core module. You can still use this individually.
Usage
Mojang Account Info
Get personal info from mojang.
import { MojangService } from "@xmcl/mojang";
const accessToken: string;
const info: Promise<MojangAccount> = MojangService.getAccountInfo(accessToken);
Validate if user have a validated IP address, and get & answer challenges to validate player's identity.
import { MojangService } from "@xmcl/mojang";
const accessToken: string;
const validIp: boolean = await MojangService.checkLocation(accessToken);
if (!validIp) {
const challenges: MojangChallenge[] = await MojangService.getChallenges(accessToken);
// after your answer the challenges
const responses: MojangChallengeResponse[];
await MojangService.responseChallenges(accessToken, responses);
}