I am trying to do something (that I think should be) very simple, connect to a Portal from a Runtime application.
However, when I run
TokenCredential credential = await IdentityManager.Current.GenerateCredentialAsync(portalUrl, "username", "password");
An exception is thrown, "The token service URL is not set."
This works fine if I am using a service url
TokenCredential credential = await IdentityManager.Current.GenerateCredentialAsync(serviceUrl, "username", "password");
What I am doing seems to me to be exactly how it is described here Access the ArcGIS platform—ArcGIS Runtime SDK for .NET | ArcGIS for Developers. But maybe I am missing something. I also tried connecting to our AGOL account and get the same exception.
What am I missing?