teocomi
(Matteo Cominetti)
2 October 2022 18:57
2
Hey @chuck ,
Most of the docs assume you have Manager running locally where that C# code is executing, and so accounts would be picked directly from there.
If your environment does not have Manager installed, I’d suggest using an auth token instead.
And here is a simple example that shows how to “fake” an account and use it: Dev Q — barebones serverside example - #2 by teocomi
UPDATE:
If, instead, you want to perform the full OAuth dance from your app, you can use this method in Core, which spins up a local server and redirect the user to the web app to perform the login:
AccountStorage.UpdateObject(account.id, JsonConvert.SerializeObject(account));
}
}
/// <summary>
/// Adds an account by propting the user to log in via a web flow
/// </summary>
/// <param name="server">Server to use to add the account, if not provied the default Server will be used</param>
/// <returns></returns>
public static async Task AddAccount(string server = "")
{
server = server.TrimEnd(new[] { '/' });
if (string.IsNullOrEmpty(server))
server = GetDefaultServerUrl();
var accessCode = "";
var challenge = GenerateChallenge();
Process.Start(new ProcessStartInfo($"{server}/authn/verify/sca/{challenge}") { UseShellExecute = true });
2 Likes