Exemplo n.º 1
0
 public IActionResult Authorization(
     [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req
     , ILogger log
     )
 {
     return(new RedirectResult(_client.BuildLoginUri()));
 }
Exemplo n.º 2
0
        public IActionResult Index()
        {
            var xconfig = new XeroConfiguration();

            xconfig.ClientId     = "713B16BE2997493E8F3F37AD00400F25";
            xconfig.ClientSecret = "GCu6vvrQ6HFgzWKsOAysK2Q78rtQW_jB_V97sKbGvulKuhib";
            xconfig.CallbackUri  = new Uri("http://localhost:5000/signin-oidc"); //default for standard webapi template
            xconfig.Scope        = "openid profile email offline_access files accounting.transactions accounting.contacts";

            var client = new XeroClient(xconfig, _httpClientFactory);

            return(Redirect(client.BuildLoginUri()));
        }
        // GET: /Authorization
        public ActionResult Index()
        {
            var serviceProvider   = new ServiceCollection().AddHttpClient().BuildServiceProvider();
            var httpClientFactory = serviceProvider.GetService <IHttpClientFactory>();

            XeroConfiguration XeroConfig = new XeroConfiguration
            {
                ClientId     = ConfigurationManager.AppSettings["XeroClientId"],
                ClientSecret = ConfigurationManager.AppSettings["XeroClientSecret"],
                CallbackUri  = new Uri(ConfigurationManager.AppSettings["XeroCallbackUri"]),
                Scope        = ConfigurationManager.AppSettings["XeroScope"],
                State        = ConfigurationManager.AppSettings["XeroState"]
            };

            var client = new XeroClient(XeroConfig, httpClientFactory);

            return(Redirect(client.BuildLoginUri()));
        }
Exemplo n.º 4
0
        public async Task <GetLoginUriQueryResult> Handle(GetLoginUriQuery request, CancellationToken cancellationToken)
        {
            var client = new XeroClient(_xeroConfig.Value, _httpClientFactory.CreateClient());

            return(await Task.Run(() => new GetLoginUriQueryResult(client.BuildLoginUri()), cancellationToken));
        }
Exemplo n.º 5
0
        public IActionResult Index()
        {
            var client = new XeroClient(XeroConfig.Value, httpClientFactory);

            return(Redirect(client.BuildLoginUri()));
        }
Exemplo n.º 6
0
        public string GetLoginUrl()
        {
            var client = new XeroClient(_xeroConfig, _httpClientFactory);

            return(client.BuildLoginUri());
        }