Created
January 8, 2021 18:00
-
-
Save SerKnight/b9bc098f77b69b4062b26120324537fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XeroConfiguration xconfig = new XeroConfiguration(); | |
xconfig.ClientId = "yourClientId"; | |
xconfig.ClientSecret = "yourClientSecret"; | |
xconfig.CallbackUri = new Uri("https://localhost:5001") //default for standard webapi template | |
xconfig.Scope = "openid profile email files accounting.transactions accounting.contacts offline_access"; | |
var client = new XeroClient(xconfig); | |
//before getting the access token please check that the state matches | |
await client.RequestAccessTokenAsync(code); | |
//from here you will need to access your Xero Tenants | |
List<Tenant> tenants = await client.GetConnections(); | |
// you will now have the tenant id and access token | |
foreach (Tenant tenant in tenants) | |
{ | |
// do something with your tenant and access token | |
//client.AccessToken; | |
//tenant.TenantId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment