Skip to content

Commit

Permalink
MicrosoftAuth: 修复 authorizationRefreshToken
Browse files Browse the repository at this point in the history
  • Loading branch information
purofle committed Dec 31, 2023
1 parent e9e05ca commit cbfec06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object MicrosoftAuth {
append("grant_type", "refresh_token")
append("client_id", CLIENT_ID)
append("refresh_token", refreshToken)
append("scope", scope ?: SCOPE.joinToString("%20"))
append("scope", scope ?: SCOPE.joinToString(" "))
})
)
}.body()
Expand Down
12 changes: 12 additions & 0 deletions src/main/kotlin/com/github/purofle/nmsl/utils/GameDownloadUtils.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.purofle.nmsl.utils

import com.github.purofle.nmsl.auth.microsoft.MicrosoftAuth
import com.github.purofle.nmsl.config.Config
import com.github.purofle.nmsl.download.DownloadProvider
import com.github.purofle.nmsl.download.GameDownloader
Expand Down Expand Up @@ -28,6 +29,17 @@ suspend fun startGame(version: String, launcherArgument: List<String>) {
downloadClientJar()
}

val auth = MicrosoftAuth.authorizationRefreshToken(Config.config.msa.refreshToken)
Config.createConfig(
Config.config.copy(
msa = Config.config.msa.copy(
accessToken = auth.accessToken,
refreshToken = auth.refreshToken,
expiresIn = auth.expiresIn
)
)
)

if (OS.CURRENT_OS != OS.WINDOWS) {
startGameUnix(launcherArgument)
} else {
Expand Down

0 comments on commit cbfec06

Please sign in to comment.