2727using System . Collections . Generic ;
2828using System . Net . Http ;
2929using System . Net . Http . Headers ;
30+ using System . Runtime . InteropServices ;
3031using System . Security . Cryptography ;
3132using System . Text ;
3233using log4net ;
@@ -47,6 +48,9 @@ public class EduTokenManager
4748
4849 public EduTokenManager ( )
4950 {
51+ if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
52+ throw new NotSupportedException ( "Minecraft Education Edition requires a Windows host." ) ;
53+
5054 _username = Config . GetProperty ( "AAD.username" , "" ) ;
5155 _password = Config . GetProperty ( "AAD.password" , "" ) ;
5256
@@ -113,9 +117,9 @@ public string FetchNewSignedToken(string tenantId, string username, string passw
113117 return payload . signedToken ;
114118 }
115119
116- string resourceUri = "https://meeservices.minecraft.net" ;
117- string clientId = "b36b1432-1a1c-4c82-9b76-24de1cab42f2" ;
118- string redirectUri = "https://login.live.com/oauth20_desktop.srf" ; // Standard void redirect AAD stuff
120+ private readonly string _resourceUri = "https://meeservices.minecraft.net" ;
121+ private readonly string _clientId = "b36b1432-1a1c-4c82-9b76-24de1cab42f2" ;
122+ //private readonly string _redirectUri = "https://login.live.com/oauth20_desktop.srf"; // Standard void redirect AAD stuff
119123
120124 public ( string IdToken , string AccessToken ) GetTokens ( string tenantId , string username , string password )
121125 {
@@ -132,10 +136,10 @@ public string FetchNewSignedToken(string tenantId, string username, string passw
132136
133137 string content = $@ "
134138 grant_type = password
135- &resource ={ resourceUri }
139+ &resource ={ _resourceUri }
136140 &username ={ username }
137141 &password ={ password }
138- &client_id ={ clientId } " ;
142+ &client_id ={ _clientId } " ;
139143
140144 message . Content = new StringContent ( content , Encoding . UTF8 , "application/x-www-form-urlencoded" ) ;
141145
0 commit comments