private string GetAccessToken() { CloudFoundryClientTokenResolver tokenResolver = new CloudFoundryClientTokenResolver(_options, _httpClient); try { string accessToken = Task.Run(() => tokenResolver.GetAccessToken()).GetAwaiter().GetResult(); return(accessToken); } catch (Exception ex) { Console.Out.WriteLine(ex.Message + ex.StackTrace); throw; } }
private string GetAccessToken() { CloudFoundryOptions options = new CloudFoundryOptions(); CloudFoundryClientTokenResolver tokenResolver = new CloudFoundryClientTokenResolver(options); try { string accessToken = tokenResolver.GetAccessToken().GetAwaiter().GetResult(); return(accessToken); } catch (Exception ex) { Console.Out.WriteLine(ex.Message + ex.StackTrace); throw new Exception("Cannont obtain the Access Token" + ex.Message); } }