Using JWT and connecting to server RRS feed

  • Question

  • Hi,

    This is probably in the wrong forum. Everything I post seems to be, so apologies for that. Searching for JWT gave me loads of forum options to see where others had posted.

    I've read up on JWT and in principle it seems reasonably straightforward. The problem I have is that I cannot find decent examples of what I am trying to do. First of all, I am writing a C# application. It is the client. My customer has a web API where I used to send data to it, and they have now asked that I modify the code in my client to connect to their server using JWT. They have given me a URL and if I use Postman and hit that URL, add in the supplied user name and password, I get back this:

        "Expires": "2019-09-24T14:16:33.178Z"

    So, I know the supplied details work. What I am trying to do now is work out how I am supposed to use that within my client application. If there is an error (let's say the supplied details aren't right, then I get this response:

        "Message": [
                "Type": "ERROR",
                "ErrorCode": "1005",
                "Text": "Unauthorized Access : Please check token/user credentials"

    So, at the moment, I have not installed any JWT Nuget packages as there are loads and I cannot find any reason to choose one over the other. All examples I read on the net are about how to write the server side bit and nothing that I can find that shows how to be the consumer.

    My client application is run via a Windows scheduled task. It runs twice a day. All it does is pull data from a Sage accounts system and constructs a bunch of objects which are then serialised into XML and sent to the customer. All that bit works and I can still get the serialised XML string, but I just don't know how to connect to the server using JWT and send it and manage the responses whether it is an error or success. Any pointers from anyone about how to post to a web service that uses JWT?


    Tuesday, September 24, 2019 4:18 PM

All replies

  • You could post to the webapi forum in ASP.NET forums for help in using JWT.


    Tuesday, September 24, 2019 7:26 PM
  • I knew it would be in the wrong place! But I'm not writing a web API myself.
    • Edited by MrSnert Wednesday, September 25, 2019 10:32 AM
    Wednesday, September 25, 2019 10:31 AM