PrismarineJS / node-minecraft-protocol

Parse and serialize minecraft packets, plus authentication and encryption.
https://prismarinejs.github.io/node-minecraft-protocol/
BSD 3-Clause "New" or "Revised" License
1.23k stars 240 forks source link

How to stop msal auth loop? microsoft auth problem #911

Open AsherJingkongChen opened 3 years ago

AsherJingkongChen commented 3 years ago

Versions minecraft-protocol: latest node: 16.11.0

File node-minecraft-protocol/examples/client_microsoft_auth/client_msal_auth.js

Problem description /usr/local/bin/node client_msal_auth.js [msa] First time signing in. Please authenticate now: To sign in, use a web browser to open the page https://www.microsoft.com/link and enter the code RUZ4DHPA to authenticate. [msa] Signed in as [msa] First time signing in. Please authenticate now: To sign in, use a web browser to open the page https://www.microsoft.com/link and enter the code 8WTDX392 to authenticate. [msa] Signed in as [msa] First time signing in. Please authenticate now: To sign in, use a web browser to open the page https://www.microsoft.com/link and enter the code Z6JXQ29Y to authenticate. [msa] Signed in as *** XboxReplayError: Request failed with status code 401 at Object.internal (/Users/yilan/node_modules/@xboxreplay/errors/dist/index.js:33:77) at /Users/yilan/node_modules/minecraft-protocol/node_modules/@xboxreplay/xboxlive-auth/dist/core/xboxlive/index.js:79:32 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async XboxTokenManager.getXSTSToken (/Users/yilan/node_modules/minecraft-protocol/src/client/tokens.js:221:18) at async retry.msa.forceRefresh (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:106:22) at async retry (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:27:14) at async MsAuthFlow.getXboxToken (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:103:14) at async retry.xbl.forceRefresh (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:119:22) at async retry (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:27:14) at async MsAuthFlow.getMinecraftToken (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:118:14) { XboxReplay: true, details: { statusCode: 500, reason: 'INTERNAL_SERVER_ERROR' } } node:internal/process/promises:246 triggerUncaughtException(err, true / fromPromise */); ^

XboxReplayError: Request failed with status code 401 at Object.internal (/Users/yilan/node_modules/@xboxreplay/errors/dist/index.js:33:77) at /Users/yilan/node_modules/minecraft-protocol/node_modules/@xboxreplay/xboxlive-auth/dist/core/xboxlive/index.js:79:32 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async XboxTokenManager.getXSTSToken (/Users/yilan/node_modules/minecraft-protocol/src/client/tokens.js:221:18) at async retry.msa.forceRefresh (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:106:22) at async retry (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:27:14) at async MsAuthFlow.getXboxToken (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:103:14) at async retry.xbl.forceRefresh (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:119:22) at async retry (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:27:14) at async MsAuthFlow.getMinecraftToken (/Users/yilan/node_modules/minecraft-protocol/src/client/authFlow.js:118:14) Emitted 'error' event on Client instance at: at Object.authenticateDeviceCode (/Users/yilan/node_modules/minecraft-protocol/src/client/microsoftAuth.js:117:12) at processTicksAndRejections (node:internal/process/task_queues:96:5) { XboxReplay: true, details: { statusCode: 500, reason: 'INTERNAL_SERVER_ERROR' } }

I clicked https://www.microsoft.com/link and it directed to https://login.live.com/oauth20_remoteconnect.srf , and I entered the device code and my password to login in the browser. It appeared successful for few seconds, and it says: You have log in Office365APIEditor in the browser now, and you can close the window. Meanwhile, the console displayed: [msa] Signed in as ****(my account) Few seconds later, the console displayed: [msa] First time signing in. Please authenticate now: To sign in, use a web browser to open the page https://www.microsoft.com/link and enter the code 8WTDX392 to authenticate.

After hours searching, I still can't figure out why it keep requiring me to login and don't know how to resolve it.

extremeheat commented 3 years ago

What date of birth is your account set to? If it's under 18 it will cause problems. Will be fixed once prismarine-auth is used, waiting for @Kashalls

AsherJingkongChen commented 3 years ago

@extremeheat Thanks for your reply, but I am 18 now. I have a screenshot of it: SmartSelect_20211011-081306_Chrome

AsherJingkongChen commented 3 years ago

I created this microsoft account few days ago, may it cause problem? And my helper tested out the same result, too.

AsherJingkongChen commented 3 years ago

I log in a paper server successfully, and I just add to a microsoft family. So, how does it work?