Closed bamlakamare closed 2 months ago
Yeah, I can reproduce the issue. Maybe they changed something. I'll look into it.
Well... https://help.minecraft.net/hc/en-us/articles/16254801392141 they need to verify apis now. I'll try to apply but for now you can create your own application and use it in web mode not spa mode as it's described here: https://github.com/dommilosz/minecraft-auth/wiki/How-to-setup-Microsoft-Auth#setup-for-web-application
i tried that but its returning an undefined access token even if the user has a minecraft account, i checked with another service (https://minecraftauth.me) and it detects the account there, i guess you have to register in both cases
It works fine in my own app in Web mode when I provide client secret. Maybe old apps continue to have access? I've sent the form I'll let you know if they respond.
I got email saying they've approved the application. Can you try test it? Please note the appid changed in the wiki.
i tried it with your appid, returning " Proof Key for Code Exchange is required for cross-origin authorization code redemption"
Please update the library to 2.0.9
It doesn't work for me yet. They said it can take up to 14 hours.
It appears to be working now! Please let me know if that's also the case for you. Make sure you're using correct appId ("74c5dc2a-449c-4224-8fe5-ca83ac47f48c")
they also approuved my request and now it works when i add the app secrate but, when using your appid its returning the same error "Proof key for code exchange", maybe you forgot to add the redirect url under the web platform?
Have you updated it to 2.0.9?
yes
That's weird. Can you post code that causes that error?
`async function f() { try { const MicrosoftAuth = minecraftAuth.MicrosoftAuth;
let account = new minecraftAuth.MicrosoftAccount();
MicrosoftAuth.setup({appID:"74c5dc2a-449c-4224-8fe5-ca83ac47f48c"});
let code = await MicrosoftAuth.listenForCode();
if(code !== undefined){
let res = await account.authFlow(code);
console.log(account)
}
}
catch (e) {
console.log(e)
}
}
f()`
Oh yeah, I forgot to update the documentation. You need to generate PKCE pair for it to work
(async ()=>{
const MicrosoftAuth = minecraftAuth.MicrosoftAuth;
let account = new minecraftAuth.MicrosoftAccount();
MicrosoftAuth.setup({appID:"74c5dc2a-449c-4224-8fe5-ca83ac47f48c"});
let pkce = MicrosoftAuth.generatePKCEPair();
let code = await MicrosoftAuth.listenForCode({pkcePair:pkce});
if(code !== undefined){
await account.authFlow(code, pkce);
await account.use();
console.log(account)
console.log(account.accessToken)
console.log(await account.getProfile());
console.log(account.username);
console.log(account.profile?.name);
}
})();
noice it works, thanks
while using the default app id or custom it throwing this error 'invalid_client: The provided request must include a 'client_secret' input parameter.'