Web APi RRS feed

  • Question

  • Hi I've done authentication on Asp Core Web Api using Token and JWT. Now the token is generated in the user part and now how do I send it to the server and do the authentication? Should the token be stored in the database?
    • Moved by CoolDadTx Monday, December 9, 2019 4:24 PM ASP.NET related
    Saturday, December 7, 2019 11:45 AM

All replies

  • ASP.NET WebAPI has a forum in ASP.NET forums.


    I guess no reads the pinned items at the top of the C# forum, huh? :)

    Saturday, December 7, 2019 12:49 PM
  • Hi Ali,

    You can create HttpClient to send the request to your web API with token as authorization request header.

    Code below is for your reference :

      var client = new HttpClient();
      client.BaseAddress = new Uri("http://example.com");
      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "YourToken");
      var result = await client.GetStringAsync("/api/ipam/prefixes/");

    For saving token in client,  it’s up to you to decide where save the token, in memory cache, in database, or in cookie.

    Hope this could be helpful.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 9, 2019 6:36 AM