1

My project is a web api project which is using owin for generating token after authentication. it is built using asp.net framework.

  1. It currently accepts token request in below format -

    var client = new RestClient("http://localhost:63202/1.0/token"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); request.AddParameter("grant_type", "client_credentials"); request.AddParameter("client_id", "12345667"); request.AddParameter("client_secret", "secret");

  2. I want my API to support Json raw body instead of URL encoded one with the token request as below -

    var client = new RestClient("http://localhost:63202/1.0/token"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); var body = @"{" + "\n" + @" "grant_type": "client_credentials"," + "\n" +@" "client_id": "1234567890""," + "\n" +@"client_secret": "channelsintegration123456789012345" + "\n" + @"}" request.AddParameter("application/json", body, ParameterType.RequestBody);

Issue - When the request is made and ValidateClientAuthentication() method is hit, the context doesn't have client id and client secret when I make the above (#2) request.

0 Answers0