Public token key in post man response is it Jwt token RRS feed

  • Question

  • User-588203678 posted
    In post method of postman I get status code 200. I am getting publictokenkey is it Jwt token key value?
    Sunday, July 5, 2020 2:41 AM

All replies

  • User-2054057000 posted

    Yes it is Jwt token key. This is digitally signed using a secret. I recommend you to have a look to How to secure APIs with JWT in ASP.NET Core 3.1 

    Sunday, July 5, 2020 3:45 AM
  • User-588203678 posted


    the below code how to get JWT TOKEN VALUE

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net.Http;
    using System.Net.Http.Headers;
    using System.Threading.Tasks;
    using JWT.API.Helpers;
    using Microsoft.AspNetCore.Http;
    using Microsoft.AspNetCore.Mvc;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;
    using RestSharp;
    namespace JWT.API.Controllers
        public class TokenController : ControllerBase
            IUserAuthenticate UsersRepository;
            public TokenController(IUserAuthenticate _UsersRepositary)
                UsersRepository = _UsersRepositary;
            // POST: api/Token
            public IActionResult token(Users UserModel)
                 var client = new RestClient("http://localhost:5125/oauth/token");
                //var client = new RestClient("http://localhost:5125/api/Token/token");
                var request = new RestRequest(Method.POST);
                request.AddHeader("content-type", "application/x-www-form-urlencoded");
              request.AddParameter("application/x-www-form-urlencoded", "grant_type=password&client_id=xamarin&client_secret=secret&username=superardmin", ParameterType.RequestBody);
                IRestResponse response = client.Execute(request);
                return Ok(response);

    Sunday, July 5, 2020 7:04 AM
  • User-2054057000 posted

    You have to install package  called Microsoft.AspNetCore.Authentication.JwtBearer from Nuget. I provided the tutorial link to you have a look to it.

    Sunday, July 5, 2020 11:35 AM
  • User-588203678 posted
    If I install package will I get Jwt token value?
    Monday, July 6, 2020 7:01 AM
  • User-588203678 posted
    After installing I am getting Status code:Not found.content length: 0
    Monday, July 6, 2020 7:19 AM
  • User711641945 posted

    Hi guhananth1,

    What is your oauth/token api?How did you define it?Please share a simple demo that could reproduce your issue.

    Best Regards,


    Monday, July 6, 2020 8:11 AM
  • User-588203678 posted
    I didn't not define oauth controller with token action result. Any way to get token value from url encoded string.in post man manually I am declaring urlencoded values. Will it generate token.

    In my maintenance project they want to create a seperate api using urlencoded values. When I pass url encoded values it must generate api token

    In seperate api project they created a Jwt token. I need to create a similar token in this new api peoject.
    Monday, July 6, 2020 8:20 AM
  • User711641945 posted

    Hi guhananth1,

    From your partial code,I could not see anything which could generate the jwt token.

    I think you need to firstly refer to the following link to learn how to generated jwt token in asp.net core:



    Best Regards,


    Monday, July 6, 2020 9:05 AM
  • User-588203678 posted

    Nothing happens on adding 


    Thursday, July 9, 2020 4:57 PM