I have a weird problem with authorization and I do not know exactly what Is going on.
So I am logged in as
an administrator user
.
Then the
Blazor Server app
accesses the
HttpClient.Host
application and I get this:
2022-11-01 15:32:25.862 +00:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-11-01 15:32:25.863 +00:00 [INF] AuthenticationScheme: Bearer was challenged.
2022-11-01 15:32:25.863 +00:00 [INF] Request finished HTTP/1.1 POST http://########/api/app/setup/setup?api-version=1.0 - 0 - 401 0 - 2.1701ms
So I am calling this method on the HttpClient.Host application:
[Authorize]
public async Task SetupAsync()
// ..
But I am logged in as a user with the role "Admin" (I checked the database, table abpuserroles).
If I log into the swagger UI (with the same user) and access the same setup method, It works?!
If I deploy the same stack locally everything works?!
I am really out of ideas what to check for ...
What could I be missing?
Thanks!
ABP Framework version: v6.0.0
UI type: Blazor
DB provider: EF Core
Tiered (MVC)
yes all menu items were missing with the admin user.
We found the issue. It seems like our reverse proxy (nginx) was not correctly configured and would not correctly proxy web sockets. We added the following to our nginx site configuration and then it worked again:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Connection "Upgrade"; // <- this line was missing
proxy_set_header Host $host;
Blazor Server uses SignalR (Websockets) to update the screen. So probably Blazor was not able to update the screen correctly.
But the error message we got on the HttpApi.Host project (see above) is still strange.
Anyway I will close this. If something comes up I will reopen it.
Thanks!