private void signout() { writeMicrosoft(null); writeMinecraft(null); CreateWV(); wv.Source = new Uri(MicrosoftOAuth.GetSignOutUrl()); }
private void login() { try { oauth = new MicrosoftOAuth("00000000402B5328", XboxAuth.XboxScope); var msToken = readMicrosoft(); var mcToken = readMinecraft(); //if (true) if (mcToken == null || DateTime.Now > mcToken.ExpiresOn) // expired { this.session = null; //if (true) if (oauth.TryGetTokens(out msToken, msToken?.RefreshToken)) // try ms login { successMS(msToken); } else // failed to refresh ms token { var url = oauth.CreateUrl(); CreateWV(); wv.Source = new Uri(url); } } else // valid minecraft session { if (this.session == null) { this.session = getSession(mcToken); } this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); this.session = null; } }
public Form1() { oauth = new MicrosoftOAuth("00000000402B5328", "service::user.auth.xboxlive.com::MBI_SSL"); InitializeComponent(); }