Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ class MicrosoftAccount : MinecraftAccount(AccountType.MICROSOFT) {
return OAuthServer(handler, authMethod).also { it.start() }
}

/**
* Create a new [MicrosoftAccount] from Microsoft Refresh token
Comment thread
MukjepScarlet marked this conversation as resolved.
*/
fun buildFromRefreshToken(token: String): MicrosoftAccount {
return MicrosoftAccount().also {
it.authMethod = AuthMethod.GENUINE_MICROSOFT
it.refreshToken = token
it.refresh()
}
}

fun replaceKeys(method: AuthMethod, string: String)
= string.replace("<client_id>", method.clientId)
.replace("<redirect_uri>", method.redirectUri)
Expand All @@ -205,6 +216,12 @@ class MicrosoftAccount : MinecraftAccount(AccountType.MICROSOFT) {
"service::user.auth.xboxlive.com::MBI_SSL",
"<access_token>"
),
GENUINE_MICROSOFT(
"00000000402B5328",
"https://login.live.com/oauth20_desktop.srf",
"service::user.auth.xboxlive.com::MBI_SSL",
"<access_token>"
),
AZURE_APP(
"0add8caf-2cc6-4546-b798-c3d171217dd9",
"http://localhost:${oauthPort}/login",
Expand Down