Open Closed

Loging and accessing the Web API from another client #3411


User avatar
0
Leonardo.Willrich created

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v5.3
  • UI type: Blazor WASM
  • DB provider: EF Core

Hi,

I'm building another Web Application in Blazor WebAssembly PWA that will just trigger some actions from my main web page application. It is not using ABP.IO framework, it is just a simple application.

To call methods from Web API, I know that I can request the Token using /access/token and using the Identity Server client details. Then, when calling the method using HttpClient, I have to add the "__tenant" and "Authorization" with "Bearer {access_token}" in the Header.

Questions:

  1. In the application service, the Current User is always Null.
  2. How can I use Dynamic API Clients using the module HttpApi.Client? Is there some example? (https://docs.abp.io/en/abp/latest/API/Dynamic-CSharp-API-Clients)
  3. I need to check the user permissions on the application side, how I can do that properly?
  4. In Post methods it is a return error related to AntiForgery ([15:57:46 ERR] The required antiforgery cookie ".AspNetCore.Antiforgery.VzbPRCldIbQ" is not present.). What is missing? Do you have an example of calling a Post method using Postman?

Kind regards,

Leonardo Willrich.


29 Answer(s)
  • User Avatar
    0
    Leonardo.Willrich created

    Well done, it works like a charm!

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    👍👍👍

  • User Avatar
    0
    Leonardo.Willrich created

    Maliming,

    The CurrentUser.Name and Surname is still empty. I couldn't find HttpContext property. My application is using Services (.Application), I don't have a controller in the .Host application.

    Following this post, https://github.com/abpframework/abp/issues/6571, I've added AbpClaimsTypes.Name and AbpClainmsTypes.Surname in the IdentityServerDataSeeder, it created the two new ApiResouceClaims records, but, didn't work. I've restarted all applications to see if it would be a cache issue, but, still not working.

    Any idea what else I can do?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Share a full project with me liming.ma@volosoft.com

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11