datalust / seq-api

HTTP API client for Seq
https://datalust.co/seq
Apache License 2.0
77 stars 21 forks source link

Azure Active Directory login support #41

Closed nblumhardt closed 5 years ago

nblumhardt commented 6 years ago

The API client can log in or access Seq using API keys, username/password authentication, or Windows integrated authentication. We should investigate logging in through Azure Active Directory to complete this.

https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-native-headless/

An additional library may be needed, in order to avoid an ADAL dependency from the core client package.

nblumhardt commented 5 years ago

API keys have been extended in v5 to accommodate this.

wjrogers commented 4 years ago

I am trying to get this working, but having no luck. I've tried both passing an Azure AD access token as the apiKey parameter to SeqConnection and setting HttpClient.DefaultRequestHeaders.Add("Authorization", "Bearer <token>"), but I always get a "401 - Please log in." response. Can you give any hints?

nblumhardt commented 4 years ago

Hi! To use API keys here, you need to log into Seq with your AAD credentials and create an API key for SeqConnection to use (either a personal key, from your user preferences, or a system key, from Settings > API keys).

Let me know if this helps :+1:

wjrogers commented 4 years ago

Got it! I thought you had meant an Azure AD access token could be used to authenticate with the API directly, but I get it now. (That would be useful because it would allow zero-configuration CLI client authentication on Windows PCs via integrated authentication, but I can live without it.) Thanks!