Hello,
Could the following SO question be related to your problem?
https://stackoverflow.com/questions/47017669/invalid-issuer-in-discovery-document-expected-angular-oauth2-oidc-with-azure-b2
We, also, use the same package mentioned in the question. There are some known issues as follows:
https://github.com/manfredsteyer/angular-oauth2-oidc/issues/108 https://github.com/manfredsteyer/angular-oauth2-oidc/issues/135
Hello again,
If you want to read some headers from the response of a cross origin request, the backend has to return those header names in Access-Control-Expose-Headers
. ABP Framework already adds its own _AbpErrorFormat
. You just need to expand this and add whatever you need.
You need to expose the header Content-Disposition
from where cors is configured.
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, builder =>
{
builder
.WithOrigins(
// ...
)
.WithAbpExposedHeaders()
.WithExposedHeaders("Content-Disposition") // <- Add this line
// ...
;
});
});
}
Now, you can simply read headers from the client. Don't forget to pass observe: Rest.Observe.Response
to the RestService
selectedInvoicesToExcelDownloadByInput(body: any): Observable<any> {
return this.restService.request<any, any>(
{
method: 'GET',
url: `/api/InvoiceManagement/AR/invoice/selectedInvoicesToExcelDownload`,
responseType: 'blob',
} as any,
{
apiName: this.apiName,
observe: Rest.Observe.Response
}
)
}
this.Invoiceservice.selectedInvoicesToExcelDownloadByInput(program).subscribe((res) => {
console.log(res.headers.get('content-disposition')); // <- will log "attachment;filename="test.txt""
})
Hello,
If you simply pass observe: 'response'
to the RestService
, it will return the whole response object which includes headers
.
selectedInvoicesToExcelDownloadByInput(body: any): Observable<any> {
let url = `${this.apiUrl.url}/api/InvoiceManagement/AR/invoice/selectedInvoicesToExcelDownload`
return this.http.post(url, body, {
responseType: 'blob',
observe: 'response' // simply add this option
})
}
I'm glad your problem is solved. Closing this issue,
Have a nice day.
Hello @MILLENNIUM,
I'm glad you were able to solve your problem.
@scott, could your problem also be related to some other configuration?
Hello,
If you can log in after few trials, it may indicate that the browser cannot store cookies/local storage values properly. You could debug your application by closely inspecting browser cookies and values in local storage to see if the token from the identity server is properly stored.
Hello scott,
Could you post an example of your request made from browser to the production site with request and response (headers as well)?
We use a similar setup for our demo and it works. You can check it out here
Hello @MILLENNIUM,
Could you post your environment.ts
and environment.prod.ts
here? This error is usually about misconfiguration.
Hello vnetonline,
It seems that your original problem is solved and your latest question is out of the scope of this thread. I'll close this issue.
If you'd like, you can open up a new ticket.
Best regards, Bunyamin
Make sure your backend has a module called app
available. You can check it by making a request to https://yourdomain.com/api/abp/api-definition?includeTypes=true
. This will return a json which will be used to generate proxies.
E.g.
If you do not explicity choose a module, the default is app
.
You can choose a module by passing a parameter after --module
.
E.g.
abp generate-proxy --module identity