This repository was archived by the owner on Apr 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Step 1: Create connection
Ole Melhus edited this page Oct 11, 2017
·
6 revisions
var dev_client_id = "...";
var dev_secret = "...";
var redirect_url = "http://localhost:44300/VismaNet/callback";
var url = VismaNet.GetOAuthUrl(dev_client_id, redirect_url);
Console.WriteLine($"Open this URL in your browser: {url}");
Console.Write("Paste code from URL: ");
var code = Console.ReadLine();
var token = await VismaNet.GetTokenUsingOAuth(dev_client_id, dev_secret, code, redirect_url);
var contexts = await VismaNet.GetContextsForToken(token);
foreach (var ctx in contexts)
{
Console.WriteLine($"{ctx.name}: {ctx.id}");
}var client_id = "client_id_from_visma";
var client_secret = "client_secret_from_visma";
var token = await VismaNet.GetToken("test@visma.com", "superMegaSecretPassword!", client_id, client_secret);
var contexts = await VismaNet.GetContextsForToken(token);
foreach (var ctx in contexts)
{
Console.WriteLine($"{ctx.name}: {ctx.id}");
}var companyId = 100000;
var token = "2d576ad3-5fbe-b7e6-1ce2-0fb41c530187";
var vismaNet = new VismaNet(companyId, token);