"Ни один пользователь не нашел подходящего имени пользователя:"
Код: Выделить всё
var handler = new HttpClientHandler() { AllowAutoRedirect = true };
var client = new HttpClient(handler);
TokenResponse tokenResponse = client.RequestPasswordTokenAsync(new PasswordTokenRequest
{
Address = "https://localhost:44328/connect/token",
ClientId = "clientid",
ClientSecret = "secret",
Scope = "api1 roles",
UserName = "username",
Password = "password"
}).Result;
Ошибка аутентификации пользователя:
invalid_username_or_password, Details: { "ClientId":"clientid",
"ClientName":"clientname", "GrantType":"password", "Scopes":"api1
roles", «AuthorizationCode»: null, «RefreshToken»: null,
«UserName»: «имя пользователя», «AuthenticationContextReferenceClasses»: null,
«Tenant»: null, «IdP»: null,
"Raw":{"grant_type":"password","username":"username","password":"REDACTED","scope":"api1
roles"},"$type":"TokenRequestValidationLog"
Почему учетные данные работают в браузере, но не при вызове клиент?
Подробнее здесь: https://stackoverflow.com/questions/797 ... g-username
Мобильная версия