Well unfortunately the new MAUI template creates and uses the OpenIddict and the solution I'm working with uses the IdentityServer tables. I was able to get Authorized though and I'm making Get calls okay now. My AuthServer : Authority url was incorrect. But I'm having trouble with posting data.
I have a CustomersAppService with an Authorize attribute. And I can make calls to a GetListAsync that also has an Authorize attribute.
This api call works.
[Authorize(RadixDealerPortalPermissions.Customers.Edit)]
public virtual async Task<List<CustomerDto>> GetCustomersAsync()
{
var items = await _customerRepository.GetListAsync();
return ObjectMapper.Map<List<Customer>, List<CustomerDto>>(items);
}
//And this api call works.
public virtual async Task<CustomerDto> GetAsync(Guid id)
{
return ObjectMapper.Map<Customer, CustomerDto>(await _customerRepository.GetAsync(id));
}
//But I can't create a customer using this call.
[AllowAnonymous]
public virtual async Task<CustomerDto> CreateAsync(CustomerCreateDto input)
{
var customer = await _customerManager.CreateAsync(
input.Name, input.Email, input.Street, input.City, input.State, input.PostalCode, input.UserId
);
return ObjectMapper.Map<Customer, CustomerDto>(customer);
}
The error I get is: The required antiforgery cookie ."AspNetCore.Antiforgery.cdV5uW_Ejgc" is not present. Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'.
I'm not exactly sure how to get the AntiforgeryToken and add it to my call. If that's what I need to do. It's not going through my AccessTokenRemoteServiceHttpClientAuthenticator class. Or do you think there's something else that would help me out? Thanks.
Thanks. I will check it out.