Closed LosTigeros closed 2 years ago
Thank you for suggestion! This feature will be added in the next version.
Minecraft does not allow Minecraft to login in browser. The default client id of minecraft is 00000000402B5328, It only allows oauth20_desktop.srf, which is for desktop applications.
So, we need to registry our own client ID. I'm trying to several client ids to login in xbox, but nothing succeeded.
Hmm, we could temporarily register this url handler in registry
And open the url without redirect_uri
query parameter or with it set like that (in case they change the default action).
After logging in it should open the app that is registered to handle this url handler by redirecting to this url
ms-xal-00000000402b5328://auth/?code=M.XX_XXX.user-access-token
If user cancels logging in it'll redirect to
ms-xal-00000000402b5328://auth/?error=access_denied&error_description=The%20user%20has%20denied%20access%20to%20the%20scope%20requested%20by%20the%20client%20application
This will pop up then:
Changes in registry:
HKEY_CLASSES_ROOT\ms-xal-00000000402b5328
On this subkey:
SetValue(null, "URL:Custom Auth Handler or launcher name");
SetValue("URL Protocol", "");
HKEY_CLASSES_ROOT\ms-xal-00000000402b5328\DefaultIcon
On this subkey:
SetValue(null, string.Format("{0}{1},1{0}", (char)34, Application.ExecutablePath));
HKEY_CLASSES_ROOT\ms-xal-00000000402b5328\shell
HKEY_CLASSES_ROOT\ms-xal-00000000402b5328\shell\open
HKEY_CLASSES_ROOT\ms-xal-00000000402b5328\shell\open\command
:
On this subkey:
SetValue(null, string.Format("{0}{1}{0} {0}%1{0}", (char)34, Application.ExecutablePath));
Or simply just create an app on Azure and use own client ID 🤣
I kind of did the first stage of authorization. I know the quality of the code is terrible. but I think this will help you understand how to do next
you can test it with clientid d827de77-7896-41ee-b446-c3f0684a8c53 and port 19722
I'm going to make new library with MSAL. It' better to use Microsoft's library rather than to make our own login logics. It also can unify all platform in one library without platform-specific codes and dependencies. (no webview2, no registry, no Net.HttpListener)
add new library: CmlLib.Core.Auth.Microsoft.MsalClient
Hey!
Would you write an ability in future so instead of creating window and using WebView2 you just:
code
param.This behavior is better because many users doesn't have WebView2 runtime installed on their PC's and we don't have to ask them to install it first just to use it once.
Greetings, Patryk.