I'm writing a (.NET) application that accesses a portal, configured for SSO.
I would like to login the current user without going through the login window at https://example.com/portal/sharing/oauth2/authorize , where you have the option to choose between AD login and ArcGIS login. Is this possible? I tried:
var url = "https://example.com/portal/sharing/rest/community/self?f=json";
var handler = new HttpClientHandler() { UseDefaultCredentials = true };
using var httpClient = new HttpClient(handler);
var json = await httpClient.GetAsync(url);
var responseBody = await json.Content.ReadAsStringAsync();
but this returns:
{"error":{"code":400,"messageCode":"COM_0019","message":"Not logged in.","details":[]}}
Or should I somehow request an access token with the default credentials? I can't find anything in the docs.