public void RefreshToken() { AccessToken Token = Authentication.RefreshAccessToken(new RefreshToken(Tokens.RefreshToken)); if (Token == null) { throw new Exception("Access Token received was null or empty"); } if (string.IsNullOrEmpty(Token._AccessToken)) { throw new Exception("Access Token received was null or empty"); } ClientConfiguration.AddApiKey("Authorization", string.Format("Bearer {0}", Token._AccessToken)); }
public void Logon(string username, string password, string domain) { var tokens = Authentication.LoginUser(new Model.AuthLogin(domain, password, username )); if (null == tokens || string.IsNullOrEmpty(tokens.AccessToken) || string.IsNullOrEmpty(tokens.RefreshToken)) { throw new Exception("The tokens provided are empty or null"); } else { Tokens = tokens; ClientConfiguration.AddApiKey("Authorization", string.Format("Bearer {0}", tokens.AccessToken)); } }