void TryToLoginByOAuth() { this.IsBusy = true; string clientId = "Ce0fa0ba8ddd23cb85c24d9c008eb78c92e2fd8caf5034032e41906938263ec04"; string clientSecret = "9cb4fa305ab61a54e8892e2ee790afe7a8ee5493acdfd04185fb948a1b0b0b35"; string redirectUri = "KitchenSink://response"; string scope = "spark:all"; var auth = new OAuthAuthenticator(clientId, clientSecret, scope, redirectUri); var sparkManager = new SparkManager(auth); ApplicationController.Instance.CurSparkManager = sparkManager; auth.Authorized(r => { this.IsBusy = false; if (r.IsSuccess) { ApplicationController.Instance.ChangeState(State.Main); } else { ApplicationController.Instance.ChangeState(State.LoginByOAuth); } }); }
void TryToLoginByJWT() { this.IsBusy = true; var auth = new JWTAuthenticator(); var sparkManager = new SparkManager(auth); ApplicationController.Instance.CurSparkManager = sparkManager; auth.Authorized(r => { this.IsBusy = false; if (r.IsSuccess) { ApplicationController.Instance.ChangeState(State.Main); } else { ApplicationController.Instance.ChangeState(State.LoginByJWT); } }); }
void TryToLoginByJWT() { this.IsBusy = true; var auth = new JWTAuthenticator(); var sparkManager = new SparkManager(auth); ApplicationController.Instance.CurSparkManager = sparkManager; sparkManager.CurSpark.Logger = ApplicationController.Instance.ShellViewModel; ApplicationController.Instance.AppLogOutput("check if authorized"); auth.Authorized(r => { this.IsBusy = false; if (r.IsSuccess) { ApplicationController.Instance.AppLogOutput("authorize success!"); ApplicationController.Instance.ChangeState(State.Main); } else { ApplicationController.Instance.ChangeState(State.LoginByJWT); } }); }