Hello Sagar.chinna,
We are trying to reproduce this issue, but it will take some time. Please have a look at the links below if you think they may be useful. https://community.fabric.microsoft.com/t5/Service/Power-BI-Rest-API-wont-accept-Application-Token/m-p/2510908 https://community.fabric.microsoft.com/t5/Service/Power-BI-Rest-API-wont-accept-Application-Token/m-p/2514468#M160047
Also could you please check you token details on https://jwt.io/ and share a screenshot of decoded details only
Please do let me know if anything else is needed.
Thank You, Anjali
Hi
can you share a screenshot of PreConfigureServices in your AuthServerModule ?
i want to see options.AddAudiences("Bookshop");
in your AuthServerModule
is it possible to share the authurl, angular and backend URL over email to support@abp.io with the ticket id?
Hello aksogut,
Thanks for confirming we are closing it.
Thank you, Anjali
Hello sanobarm@cloudassert.com,
Thank you for your confirmation. Closing the ticket.
Thank you, Anjali
Hi,
Can you share your PreConfigureService Code from HttpApiHostModule?
Hello alexander.nikonov,
After logout it will redirect to your landing page i.e. Home and if you are calling any api's inside home component which is not authorized then this 401 error occurs for that particular api's. For reproduce the same Issue I added 1 api in Home component. I am calling that api in ngOnInit ( initial method ) with login it is working fine. But if I logout then we are facing 401 status in network tab the reason is we are calling api's without authorized.
I tried with your code to call api's which is inside ngOnInitInner which was giving me error without if (this.authService.isAuthenticated) { }
block
please check the Initiator column for which api's you are getting 401 error and try to add those api calls inside this if (this.authService.isAuthenticated) { }
block
When I tried with if (this.authService.isAuthenticated) { }
block , that api will not get call and hence not get any error.
protected ngOnInitInner() {
if (this.authService.isAuthenticated) {
this.homeService.getNewsForHomePage()
.pipe(take(1))
.subscribe((newsResponse) => {... });
this.homeService.getUrlsForHomePage()
.pipe(take(1))
.subscribe((newsUrlParameterResponse) => {... });
}
}
If the value by authService.isAuthenticated
is not giving false
on logout then please try this
if (this.configStateService.getDeep('currentUser.isAuthenticated')) {}
please do let me know if it helps you,
Thank you, Anjali
Hello aksogut ,
Please check this document if found helpful for you
https://dev.iyzipay.com/en/api/installment-service
Thank you, Anjali
Hello darutter,
Please try with below example:-
I have created first Entity as Employee -> EmployeeName, Age Second Entity as Items -> ItemName, ItemInfo I have added Navigation (manytomany) from Employee to Items.
public class EmployeeExcelNewDto
{
public String EmplyeeName { get; set; }
public int Age { get; set; }
public String ItemName { get; set; }
}
EfCoreEmployeeRepository
protected virtual async Task<IQueryable<EmployeeWithNavigationProperties>> GetQueryForNavigationPropertiesAsync()
{
var dbContext = await GetDbContextAsync();
return from employee in (await GetDbSetAsync())
select new EmployeeWithNavigationProperties
{
Employee = employee,
Items = (from itm in dbContext.Items
join empitm in employee.Items on itm.Id equals empitm.ItemId
select itm).ToList()
};
}
EmployeesAppService
public virtual async Task<IRemoteStreamContent> GetListAsExcelFileAsync(EmployeeExcelDownloadDto input)
{
var downloadToken = await _excelDownloadTokenCache.GetAsync(input.DownloadToken);
if (downloadToken == null || input.DownloadToken != downloadToken.Token)
{
throw new AbpAuthorizationException("Invalid download token: " + input.DownloadToken);
}
var employees = await _employeeRepository.GetListWithNavigationPropertiesAsync(input.FilterText, input.EmployeeName, input.AgeMin, input.AgeMax);
var List = new List<EmployeeExcelNewDto>();
employees.ForEach(eitem =>
{
foreach (var i in eitem.Items)
{
var emp = new EmployeeExcelNewDto
{
EmplyeeName = eitem.Employee.EmployeeName,
Age = eitem.Employee.Age,
ItemName = i.ItemName
};
List.Add(emp);
};
});
var memoryStream = new MemoryStream();
await memoryStream.SaveAsAsync(List);
memoryStream.Seek(0, SeekOrigin.Begin);
return new RemoteStreamContent(memoryStream, "Employees.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
}
Output excel will be like
Please do let me know if this helps you,
Thank you, Anjali
Hello alexander.nikonov,
import { AuthService } from '@abp/ng.core';
constructor(private authService: AuthService)
ngOnInit()
{
if (this.authService.isAuthenticated) //like -> this.configStateService.getDeep('currentUser.isAuthenticated')
{
this.homeService.getNewsForHomePage()
this.homeService.getNewsForHomePage()
//other code and API which you are calling at initial...
}
}
Could you please try with this code
.pipe(filter(() => this.configStateService.getDeep('currentUser.isAuthenticated'))
This condition will not work as it's not authorized, so will not execute the next statement.
HomeComponent
get calls whether user logged in or not, so without get authorized it will give error.
please do let me know if this helps you.
Thank you, Anjali