mindstorm38 / portablemc

A fast, reliable and cross-platform command-line Minecraft launcher and API for developers. Including fast and easy installation of common mod loaders such as Fabric, Forge, NeoForge and Quilt.
https://pypi.org/project/portablemc/
GNU General Public License v3.0
320 stars 19 forks source link

Issue login with Microsoft auth #199

Closed Gustoon closed 4 months ago

Gustoon commented 4 months ago

When I try to connect with Microsoft, and I fill out everything on the web page, the terminal gets stuck at one step: [ .. ] Opened authentication page in browser... and it does not ask me for the code displayed on the internet page. What to do?

mindstorm38 commented 4 months ago

Are you redirected to theorozier.fr/portablemc/auth? What is saying that page? Looks like it fails to forward the answer to the local server, if so I would be interested in seeing the network log of your web browser.

Gustoon commented 4 months ago

Yes, I am redirected to this site once logged in. On this page, it is written: Forwarding request to your local launcher (port 62772) No local launcher detected, if requested you can copy the following code: A code

mindstorm38 commented 4 months ago

Ok, this is weird. Do you see anything weird on your web browser network view? In particular the reason for why the request doesn't succeed. Anyway, I think you could temporarily fix the problem by using --auth-no-browser, but you'll have to manually enter URL and code. If you have some time I would like to fix the issue (if on my side)..

Gustoon commented 4 months ago

I just checked in "inspect -> network" and there is an error "?id_token=...". And --auth-no-browser also gives me an error even though I have a Minecraft account.

mindstorm38 commented 4 months ago

Without giving us any personal info, could you be more precise about the error with the request to localhost? I'm afraid there are some kind of cross site issue...

Gustoon commented 4 months ago

yes I want to but how?

mindstorm38 commented 4 months ago

image With something like this

Gustoon commented 4 months ago

ok : problem

mindstorm38 commented 4 months ago

Ok so the request is blocked by your browser, as I expected. Is there any error message in the "console" tab related to blocked request ?

Gustoon commented 4 months ago

I have this error : net::ERR_BLOCKED_BY_CLIENT

mindstorm38 commented 4 months ago

What is the error when you use no-browser option ?

Gustoon commented 4 months ago

When I paste the code and press "Enter", I get this error: [FAILED] Error authenticating:

mindstorm38 commented 4 months ago

Everything works on my side, I don't understand, at least no-browser should work

Gustoon commented 4 months ago

i using brave browser

Gustoon commented 4 months ago

I tested without my ad blocker but it made the same error as when I use --auth-no-browser

mindstorm38 commented 4 months ago

Interesting, so there is still an issue with authentication itself... This is way harder to debug however.

Gustoon commented 4 months ago

Yes surely

mindstorm38 commented 4 months ago

I spotted some cases where the there are no explanatory error message, and this is either when token is outdated (unlikely) or if you don't own the game. Are you sure that you use the correct account ?

I'll try to improve the message, but authentication errors are somewhat undocumented for multiple authentication services involved (Microsoft OAuth2 -> Xbox Live -> XSTS -> Minecraft auth).

Gustoon commented 4 months ago

Yes i have the correct account. Do I need to do an update to obtain these new messages?

mindstorm38 commented 4 months ago

I've modified the launcher to be more explicit about outdated token/game not owned in the latest v4.3 branch, but this is not yet released. You can try it, I hope with pip -v install --upgrade --force-reinstall "git+https://github.com/mindstorm38/portablemc.git@v4.3" (seems to require git to be installed).

Gustoon commented 4 months ago

It tells me: "Error authenticating: does not own minecraft" while on minecraft.net it tells me that I own minecraft.

mindstorm38 commented 4 months ago

This is interesting at least because we know that it's the last step that is blocked. I'll add more debug later you'll able to test. Maybe there are more information that I currently do not show...

Gustoon commented 4 months ago

Ok.

mindstorm38 commented 4 months ago

Can you try again? I added more verbosity to the error.

Gustoon commented 4 months ago

I redid the update pip -v install --upgrade --force-reinstall "git+https://github.com/mindstorm38/portablemc.git@v4.3" and now its march! I really don't know why.

mindstorm38 commented 4 months ago

Wow, didn't expected that lmao

Thank you Microsoft... One more unresolved bug!

Gustoon commented 4 months ago

Now maybe you can implement this update on the github repository?

mindstorm38 commented 4 months ago

Yes I'll keep this, maybe with better diagnostics.

Gustoon commented 4 months ago

You can also add text on the redirect page that says to deactivate the ad blocker because when I had an ad blocker, it worked even less! (if you want).

mindstorm38 commented 4 months ago

I'll add this when the GitHub pipeline will work again (my CI is crashing without any message atm)

Gustoon commented 4 months ago

ok, can i close the issue?

mindstorm38 commented 4 months ago

I guess so

mindstorm38 commented 4 months ago

image When I said that the CI is blocked... lmao