Skip to content

Commit

Permalink
Format Minecraft Services response
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienHH committed Aug 22, 2024
1 parent 47cd9a4 commit 03293e2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/TokenManagers/MinecraftServicesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MinecraftServicesTokenManager {
const expires = new Date(token.validUntil)
const remainingMs = expires - Date.now()
const valid = remainingMs > 1000
return { valid, until: expires, token: token.authorizationHeader, data: token }
return { valid, until: expires, token: token.mcToken, data: token }
}

async setCachedToken(data) {
Expand Down Expand Up @@ -48,9 +48,17 @@ class MinecraftServicesTokenManager {
})
}).then(checkStatus)

debug('[mc] mc-services token response', response.result)
const tokenResponse = {
mcToken: response.result.authorizationHeader,
validUntil: response.result.validUntil,
treatments: response.result.treatments,
configurations: response.result.configurations,
treatmentContext: response.result.treatmentContext
}

await this.setCachedToken({ mcs: response.result })
debug('[mc] mc-services token response', tokenResponse)

await this.setCachedToken({ mcs: tokenResponse })

return response.result

Expand Down

0 comments on commit 03293e2

Please sign in to comment.