- ABP Framework version: v8.3.2
- UI Type: Blazor WebApp
- Database System: EF Core - SQL Server
- Tiered (for MVC) or Auth Server Separated (for Angular): no
- Exception message and full stack trace:
- Steps to reproduce the issue:
Previously I had an application in blazor webassembly since it was born in net core 6. After migrating to Blazor WebApp I am having problems since one of my components injects the IAccessTokenProvider interface (belongs to Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll).
After the migration this service is no longer injected, moreover, I have tried to inject IAbpAccessTokenProvider, but the implementation I get is Volo.Abp.AspNetCore.Components.WebAssembly.WebApp.CookieBasedWebAssemblyAbpAccessTokenProvider, which after reviewing its code, returns a null string.
By default I use InteractiveAutoRenderMode with prerender set to false. I've tried to indicate in the component that it uses the InteractiveWebAssemblyRenderMode interface but it doesn't solve anything. Any idea?
18 Answer(s)
-
0
hi
The web app has two modes,
server
andwasm
.CookieBased
means you don't need to get the access token because of the authentication state in the cookies.You can request the API, The browser will add the cookies automatically.
-
0
After trying to remove its use, the request continues to fail.
-
0
Hi
Can you check if the request contains the authentication cookies in Chrome devtool?
You’re not using tiered blazor project. Right?
-
0
-
0
-
0
-
0
hi
You have a webapp project, but you have two domains.
localhost
andlocalhost:44362
Can you explain this?
-
0
As far as I know we don't manage that, localhost is my computer and 44362 is the port where the application is exposed when debugging, which is configured in the appsettings.
What are the risks of this being different, and do they need to be the same? If so, how can I change it?
-
0
hi
Can you share the test project so I can reproduce the problem locally?
liming.ma@volosoft.com
Thanks
-
0
Hi, I can't share a sample project as it is a final application.
-
0
hi
You can test your code in a new template project and share the template source code.
Thanks.
-
0
After creating a new project, the only thing I added was an AppService without complexity, with a method without parameters or functional implementation, to test a call to the api, and the result I get is the same as in the final application, attached images:
Additionally, it also does not inject microsoft's IAccessTokenProvider.
-
0
Can you reproduce the Problem in the new template?
If so, Please share the template with liming.ma@volosoft.com
I will download and test it.
Thanks.
-
0
Yes, as I have attached in the images, it does reproduce. I will send it to you now. Thank you!
-
0
Thanks, you can share it via https://wetransfer.com/
-
0
-
0
Sorry, but I'm missing the point of this thread.
- You have asked about whether the cookie and the domain are on the same port.(https://abp.io/qa/questions/8623/3a17711b-c085-7e46-9c30-f1b7dd14075f).
- After answering you that the cookie appears localhost without port you told me that I have two domains and that I can explain it to you.(https://abp.io/qa/questions/8623/3a17713f-4e4b-d3d1-0501-248f5f43d968).
- I asked you what risks this entails and how I could change it, as I have not changed any of it, to which I received the reply of sending you the test project. Where you then asked me for a new abp project.
- I implement a new solution and add two screenshots where you can see that exactly the same thing is happening.
- I send you the project and your answer is that the api requests are correct, where in the gif you can't see the api headers and you can see that the cookie is "localhost".
I need to get the token so I can assign it to a request.
-
0
hi
Sorry, there is no access token in the no-tiered Blazor web app
Because it uses the Cookie authentication.
Cookie is represented a user.