CmlLib
한국어 (v3)
한국어 (v3)
  • 🧊CmlLib Projects
  • [AD] 커스텀 런처 주문제작
  • 🚀CmlLib.Core
    • 홈
    • 시작하기
      • CMLauncher
      • 게임 경로 설정
      • 실행 옵션 설정
      • 이벤트 처리
    • 로그인과 세션
      • 마이크로소프트 엑스박스 계정
      • 예전 모장 계정
      • 오프라인 계정
    • 고급 기능
      • VersionLoader
      • Version
      • FileChecker
      • Downloader
    • 모드 로더 인스톨러
      • Forge Installer
      • Fabric Installer
      • LiteLoader Installer
    • 유틸리티
      • Minecraft Changelogs
    • 자료
      • 자주 묻는 질문
      • 알려진 문제
      • 예시 런처
      • 라이센스
  • 🔓Auth.Microsoft
    • 홈
    • CmlLib.Core.Auth.Microsoft
      • JELoginHandler
      • JELoginHandlerBuilder
      • JEAuthenticator
    • XboxAuthNet.Game
      • OAuth
      • XboxAuth
      • XboxAuthException
      • AccountManager
      • Accounts
    • XboxAuthNet.Game.Msal
      • ClientID
      • MsalClientHelper
      • OAuth
    • CmlLib.Core.Bedrock.Auth
    • 자료
  • 🌐MojangAPI
    • 홈
    • Mojang API
    • SecurityQuestion
  • ⚒️Installer.Forge
    • 홈
    • 지원되는 버전
    • 시작하기
    • MForge
    • ForgeVersionLoader
Powered by GitBook
On this page
  • Methods (QuestionFlow class)
  • CheckTrusted
  • GetQuestionList
  • SendAnswers
Edit on GitHub
  1. MojangAPI

SecurityQuestion

This is required to get the skin change endpoint to work in case the services do not trust your IP yet.

Most methods return MojangAPIResponse or class inherited from MojangAPIResponse. You can check whether the request was successful or failed to check IsSuccess property in MojangAPIResponse. If IsSuccess is false, Error and ErrorMessage property tell you why the request failed.

Example:

using MojangAPI.SecurityQuestion;

HttpClient httpClient = new HttpClient();
QuestionFlow questionFlow = new QuestionFlow(httpClient);

try
{
    await questionFlow.CheckTrusted("accessToken");
    Console.WriteLine("Your IP was trusted");
}
catch
{
    QuestionList questions = await questionFlow.GetQuestionList("accessToken");
    for (int i = 0; i < questions.Count; i++)
    {
        Question question = questions[i];
        Console.WriteLine($"Q{i + 1}. [{question.QuestionId}] {question.QuestionMessage}");
        Console.Write("Answer? : ");

        var answer = Console.ReadLine();
        question.Answer = answer;
        Console.WriteLine();
    }

    await questionFlow.SendAnswers(questions, session.AccessToken);
    Console.WriteLine("Success");
}

Methods (QuestionFlow class)

CheckTrusted

Check if security questions are needed.

try
{
    await questionFlow.CheckTrusted("accessToken");
    // trusted
}
catch 
{
    // security questions are needed
}

GetQuestionList

QuestionList questionList = await questionFlow.GetQuestionList("accessToken");
foreach (Question q in questionList)
{
    // q.QuestionId
    // q.QuestionMessage
    // q.AnswerId
    // q.Answer
}

SendAnswers

QuestionList list; // you can get this from GetQuestionsList method, like 'questionList' variable above.
await questionFlow.SendAnswers(list, "accessToken");
PreviousMojang APINext홈

Last updated 1 year ago

🌐