-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathHomeController.cs
34 lines (28 loc) · 1.13 KB
/
HomeController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Intuit.Ipp.OAuth2PlatformClient;
using Microsoft.AspNetCore.Mvc;
using QBO.Shared;
using QBO.WebApp.Models;
using System.Diagnostics;
namespace QBO.WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
// Use the shared helper library (QBO.Shared)
// to load the token json data (Local.Tokens)
// and initialize the OAuth2
// client (Local.Client).
QboLocal.Initialize("..\\QBO.Shared\\Tokens.jsonc");
// redirect the local host to
// a generated authorization URL.
return Redirect(QboHelper.GetAuthorizationURL(OidcScopes.Accounting));
}
#region ASP.NET Default Code
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger) => _logger = logger;
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() => View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
#endregion
}
}