applicationId uz neni povinne
This commit is contained in:
@@ -27,8 +27,17 @@ public sealed class DokladApiFactory
|
||||
{
|
||||
var httpClient = _httpClientFactory.CreateClient(HttpClientName);
|
||||
|
||||
var builder = new DokladApiBuilder(_settings.AppName, _settings.AppVersion)
|
||||
.AddClientCredentialsAuthentication(credentials.ClientId, credentials.ClientSecret, credentials.ApplicationId)
|
||||
// With an ApplicationId, use the SDK's client_credentials (sends application_id).
|
||||
// Without it, authenticate with client_id + client_secret only (iDoklad's default).
|
||||
DokladApiBuilder builder = string.IsNullOrWhiteSpace(credentials.ApplicationId)
|
||||
? new ClientSecretDokladApiBuilder(
|
||||
_settings.AppName,
|
||||
_settings.AppVersion,
|
||||
new ClientSecretAuthentication(credentials.ClientId, credentials.ClientSecret))
|
||||
: new DokladApiBuilder(_settings.AppName, _settings.AppVersion)
|
||||
.AddClientCredentialsAuthentication(credentials.ClientId, credentials.ClientSecret, credentials.ApplicationId);
|
||||
|
||||
builder = builder
|
||||
.AddHttpClient(httpClient)
|
||||
.AddApiContextOptions(options => options.Language = credentials.Language);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user