static void Main(string[] args) { try { // TODO: Add logic to get the logged on user's refresh token // from secured storage. bool b2b = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("b2b")); UserOperations userOperations = new UserOperations(); if (!b2b) { _tokens = GetOauthTokens_AuthCode(_storedRefreshToken, _clientId); PrintTokens(_tokens.AccessToken, _tokens.RefreshToken, _tokens.Expiration); userOperations.CreateUser(_tokens.AccessToken); userOperations.GetUsers(_tokens.AccessToken); } else { _b2bTokens = GetToken(_storedRefreshToken, _clientId); PrintTokens(_b2bTokens.AccessToken, _b2bTokens.RefreshToken, _b2bTokens.Expiration); userOperations.GetUsers(_b2bTokens.AccessToken); } Console.ReadLine(); } catch (Exception e) { Console.WriteLine("\n" + e.Message); } }
private static B2BGrantOauth GetToken(string refreshToken, string clientId) { B2BGrantOauth auth = new B2BGrantOauth(clientId); auth.GetAccessToken(); return(auth); }