minecraft-launcher-core-node icon indicating copy to clipboard operation
minecraft-launcher-core-node copied to clipboard

Add method to login with access token

Open Pixelwarp opened this issue 2 years ago • 3 comments

Basically could be this ` const { loginWithAccessToken } = require('@xmcl/user');

const user = loginWithAccessToken('access_token'); // returns null if access token is invalid

// User methods user.username; user.accessToken; `

Pixelwarp avatar Mar 24 '22 12:03 Pixelwarp

Can you describe it more? (I don't know how to get username or other from only accessToken). In old protocol, we can have refresh operation by input client & access token to get the selectedProfile.

Or, are you trying to resolve the Microsoft login issue (#232)?

ci010 avatar Apr 04 '22 15:04 ci010

@ci010 You could use https://api.minecraftservices.com/minecraft/profile, then add a header called "Authorization" with the value of "Bearer ACCESS_TOKEN" then it would return current skin and username and UUID, and etc

Pixelwarp avatar Apr 15 '22 12:04 Pixelwarp

GET Request

Pixelwarp avatar Apr 15 '22 12:04 Pixelwarp

See new release version https://github.com/Voxelum/minecraft-launcher-core-node/blob/master/packages/user/mojang.ts#L243 should resolve this issue.

ci010 avatar Apr 13 '23 14:04 ci010