Coder Social home page Coder Social logo

Comments (13)

extremeheat avatar extremeheat commented on June 21, 2024

Hi, what's your objective ?

I think it was removed from the current README, but this information is returned after you do a call to Authflow.getXboxToken.

{
  userXUID: string,
  userHash: string,
  XSTSToken: string,
  expiresOn: number
}

If you need a token for minecraft bedrock, the getMinecraftBedrockToken method returns three JWTs which contain the xuid and other relevant minecraft data.

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

Hi, what's your objective ?

I think it was removed from the current README, but this information is returned after you do a call to Authflow.getXboxToken.

{
  userXUID: string,
  userHash: string,
  XSTSToken: string,
  expiresOn: number
}

If you need a token for minecraft bedrock, the getMinecraftBedrockToken method returns three JWTs which contain the xuid and other relevant minecraft data.

const { Authflow } = require('prismarine-auth');

const doAuth = async() => {
const flow = new Authflow('[email protected]', process.cwd(), { fetchProfile: true })
const response = await flow.getMinecraftBedrockToken()
console.log(response)
}

doAuth()

After I change like this,still have not get the XUID from response

from prismarine-auth.

extremeheat avatar extremeheat commented on June 21, 2024

What do you get in the response ? For bedrock, you need to provide a seperate keypair like in the docs here - https://github.com/PrismarineJS/prismarine-auth/blob/master/examples/bedrock/deviceCode.js

If you just want the XUID you can just call getXboxToken() with no parameters instead of getMinecraftBedrockToken.

const { Authflow } = require('prismarine-auth')
const flow = new Authflow()
flow.getXboxToken().then(console.log)

see https://github.com/PrismarineJS/prismarine-auth/blob/master/docs/API.md

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

What do you get in the response ? For bedrock, you need to provide a seperate keypair like in the docs here - https://github.com/PrismarineJS/prismarine-auth/blob/master/examples/bedrock/deviceCode.js

If you just want the XUID you can just call getXboxToken() with no parameters instead of getMinecraftBedrockToken.

const { Authflow } = require('prismarine-auth')
const flow = new Authflow()
flow.getXboxToken().then(console.log)

see https://github.com/PrismarineJS/prismarine-auth/blob/master/docs/API.md

This is my code

const doAuth = async() => {
const flow =await new Authflow()
flow.getXboxToken().then(console.log)
}

doAuth()

respone

(node:224) UnhandledPromiseRejectionWarning: Error: username is required
at new MicrosoftAuthFlow (C:\Users\whes1015\node_modules\prismarine-auth\src\MicrosoftAuthFlow.js:29:26)
at doAuth (C:\Users\whes1015\Desktop\discordbot\index.js:124:63)
at C:\Users\whes1015\Desktop\discordbot\index.js:128:47
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

from prismarine-auth.

extremeheat avatar extremeheat commented on June 21, 2024

Please specify a username and caching dir for now until the master branch is released on npm

const { Authflow } = require('prismarine-auth')
const flow = new Authflow('username', './')
flow.getXboxToken().then(console.log)

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

Please specify a username and caching dir for now until the master branch is released on npm

const { Authflow } = require('prismarine-auth')
const flow = new Authflow('username', './')
flow.getXboxToken().then(console.log)

I didn't get any response

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

Please specify a username and caching dir for now until the master branch is released on npm

const { Authflow } = require('prismarine-auth')
const flow = new Authflow('username', './')
flow.getXboxToken().then(console.log)

image

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

請暫時指定用戶名和緩存目錄,直到在 npm 上發布 master 分支

const  { Authflow }  =  require ( 'prismarine-auth' ) 
const  flow  =  new  Authflow ( 'username' ,  './' ) 
flow 。獲取XboxToken ( ) 。然後(控制台。日誌)

(node:2172) UnhandledPromiseRejectionWarning: XboxReplayError: Could not exchange "userToken", please double check the specified "XSTSRelyingParty" or refer to https://bit.ly/xr-xbl-auth-user-token-issue
at Object.internal (C:\Users\whes1015\node_modules@xboxreplay\errors\dist\index.js:33:77)
at C:\Users\whes1015\node_modules\prismarine-auth\node_modules@xboxreplay\xboxlive-auth\dist\core\xboxlive\index.js:76:32
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async XboxTokenManager.getXSTSToken (C:\Users\whes1015\node_modules\prismarine-auth\src\TokenManagers\XboxTokenManager.js:149:18)
at async retry.msa.forceRefresh (C:\Users\whes1015\node_modules\prismarine-auth\src\MicrosoftAuthFlow.js:130:24)
at async retry (C:\Users\whes1015\node_modules\prismarine-auth\src\MicrosoftAuthFlow.js:22:14)
at async MicrosoftAuthFlow.getXboxToken (C:\Users\whes1015\node_modules\prismarine-auth\src\MicrosoftAuthFlow.js:120:14)
(Use node --trace-warnings ... to show where the warning was created)
(node:2172) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:2172) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[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 9JL2QUBP to authenticate.

from prismarine-auth.

extremeheat avatar extremeheat commented on June 21, 2024

This is fixed in #13. Try:

npm i prismarinejs/prismarine-auth#docs

then see if you get the same error

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

npm iprismarinejs/prismarine-auth#docs

I got the response like this

[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 YDLLJVFZ to authenticate.
[msa] Signed in as [email protected]
[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 BRA2AG8H to authenticate.

code

const doAuth = async () => {

const flow = await new Authflow('[email protected]', './caches/')
flow.getXboxToken().then(console.log)

}

doAuth()

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

這已在#13中修復。嘗試:

npm iprismarinejs/prismarine-auth#docs

然後看看你是否得到同樣的錯誤

I was asked to log in twice and got the same reply

[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 YDLLJVFZ to authenticate.
[msa] Signed in as [email protected]
[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 BRA2AG8H to authenticate.
[msa] Signed in as [email protected]
(node:508) UnhandledPromiseRejectionWarning: XboxReplayError: Could not exchange "userToken", please double check the specified "XSTSRelyingParty" or refer to https://bit.ly/xr-xbl-auth-user-token-issue
at Object.internal (C:\Users\whes1015\node_modules@xboxreplay\errors\dist\index.js:33:77)
at C:\Users\whes1015\node_modules\prismarine-auth\node_modules@xboxreplay\xboxlive-auth\dist\core\xboxlive\index.js:76:32
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async XboxTokenManager.getXSTSToken (C:\Users\whes1015\node_modules\prismarine-auth\src\TokenManagers\XboxTokenManager.js:149:18)
at async retry.msa.forceRefresh (C:\Users\whes1015\node_modules\prismarine-auth\src\MicrosoftAuthFlow.js:130:24)
at async retry (C:\Users\whes1015\node_modules\prismarine-auth\src\MicrosoftAuthFlow.js:22:14)
at async MicrosoftAuthFlow.getXboxToken (C:\Users\whes1015\node_modules\prismarine-auth\src\MicrosoftAuthFlow.js:120:14)
(Use node --trace-warnings ... to show where the warning was created)
(node:508) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:508) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

from prismarine-auth.

whes1015 avatar whes1015 commented on June 21, 2024

這已在#13 中修復。嘗試:

npm iprismarinejs/prismarine-auth#docs

然後看看你是否得到同樣的錯誤

I just want XUID, is there any other way to get it? I just want XUID,thanks

from prismarine-auth.

extremeheat avatar extremeheat commented on June 21, 2024

This is not a support forum, please discuss on Discord. You need to install it from git to get the latest update which fixes your issue.

npm install prismarinejs/prismarine-auth

per discord conversation, for future reference, the issue was relyingParty needs to be set to xboxlive.com.

const { Authflow, Titles } = require('prismarine-auth')
const flow = new Authflow('', './', { authTitle: Titles.MinecraftNintendoSwitch, relyingParty: 'http://xboxlive.com' })
flow.getXboxToken().then(console.log)

from prismarine-auth.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.