Token Based Authentication in Web Service Asp.Net c# || Part-11

Поділитися
Вставка
  • Опубліковано 4 січ 2025

КОМЕНТАРІ • 38

  • @Qur2aan
    @Qur2aan 2 роки тому

    how to check the validity of token when coming back to the web service for exporting data?

  • @mhosneddineify
    @mhosneddineify 7 років тому

    hello, do you have an example using vb.net and a method and how to consume the service in android.

  • @harjeetguitar
    @harjeetguitar 4 роки тому

    After having the new guid(token) client side, what is suppose to happen next, how it is able to authenticate with the server. Are we going to send that token back to server for authentication ???

    • @DotNetRevanth
      @DotNetRevanth  4 роки тому

      After the token generated from client token will be sent in headers to the server for authentication.

    • @harjeetguitar
      @harjeetguitar 4 роки тому

      @@DotNetRevanth But its a normal guid, it's not JWT. If we just need to send back plain token to server then why don't we pass credentials as a part of request and validate it. Do you have any project with JWT and database

    • @DotNetRevanth
      @DotNetRevanth  4 роки тому

      @@harjeetguitar I didn't have a sample of JWT but I will soon post one. Subscribe and keep watching :)

  • @imjaypz
    @imjaypz 5 років тому

    Thank you, very helpful.

    • @DotNetRevanth
      @DotNetRevanth  5 років тому

      Thanks for watching +John.
      Subscribe and keep watching.

  • @itteamnhmharyana3888
    @itteamnhmharyana3888 4 роки тому

    It add Username and password for Authentication in every web service header with Authentication key. Is it not possible to use same key for multiple web service call

    • @DotNetRevanth
      @DotNetRevanth  4 роки тому

      Every user as unique auto generated token after authentication. It should be passed in header to access other service methods.

  • @marvinpinto9596
    @marvinpinto9596 4 роки тому

    How can I consume with a tool that is like SOAP UI or POSTMAN??

    • @DotNetRevanth
      @DotNetRevanth  4 роки тому

      Using WSDL file or WSDL url consume in SOAP tool and pass the necessary input fields.
      POSTMAN or FIDDLER - Tests for WEBAPI or RestFull service.
      Please subscribe and keep watching :)

  • @jayaharitham509
    @jayaharitham509 2 роки тому

    With the generated token how could i access the webservice?

    • @DotNetRevanth
      @DotNetRevanth  2 роки тому

      Watch the video its included in it. Keep watching :)

  • @josefidalgo78
    @josefidalgo78 7 років тому

    the problem is: if i don't put public SecuredTokenWebservice SoapHeader = new SecuredTokenWebservice();
    Gives error 500, no access web service.
    In your example you have just public SecuredTokenWebservice SoapHeader.
    if I put public SecuredTokenWebservice SoapHeader = new SecuredTokenWebservice();
    when the client application goto second method of webservices don't have information from SoapHeader.

  • @musaaslan8713
    @musaaslan8713 8 років тому +1

    Hi,
    Can we use this usage(writing a method before calling the method) in wcf service
    [WebMethod]
    [System.Web.Services.Protocols.SoapHeader("SoapHeader")]
    public string Authenticate()
    {
    }
    thank you for your helps

    • @DotNetRevanth
      @DotNetRevanth  8 років тому +1

      Thanks +Musa Aslan. For watching the video.
      In WCF sending or setting a soap header is little different.
      I will help you on this.
      SUBSCRIBE to my channel thank you.

    • @musaaslan8713
      @musaaslan8713 8 років тому

      I have one more question. I follow the video but my token expires in only 20 minutes. I changed ISS session timeout and added to web config "". is there anything else to do for live my token about one hour?

    • @DotNetRevanth
      @DotNetRevanth  8 років тому

      Thanks +Musa Aslan. For watching the video.
      I have already discussed in the video. You can add Days, Hours, Minutes etc in Webservice to expire the token. Check at the video time 10.44.
      Reference: goo.gl/ICzLRu

    • @musaaslan8713
      @musaaslan8713 8 років тому

      thank you for your reply. I found my problem is becaus of "Idle Time-out Settings for an Application Pool" on IIS.

    • @DotNetRevanth
      @DotNetRevanth  8 років тому

      That's nice to see your problem got solved. Keep watching :)

  • @joaysyamsul9232
    @joaysyamsul9232 4 роки тому

    can you help me please , how to enter data into the database with a token Authentication

    • @DotNetRevanth
      @DotNetRevanth  4 роки тому

      Hey +Jo'Ay Syamsul.
      First step is when a new user login call the API if it Username & Password is valid (Check via DB) generate token and insert into DB.
      Second step is when same user with username and token try to access service methods in API do a initial DB call to validate the token with in the method. If valid continue to remaining logic in the method. If not valid return with error message.

  • @venugopalnimmagadda563
    @venugopalnimmagadda563 7 років тому

    Revanth, what is the difference in created webservice using webservice vs class?

    • @DotNetRevanth
      @DotNetRevanth  7 років тому

      Hi +Venugopal, Thanks for watching the video.
      Well webservice can be consumed in multiple projects once the webservice is hosted in the other server and it has the ability that we can the required action methods.
      But class, there is no way of consuming or calling required methods in other applications.
      I hope you have got the idea.
      Thank you.. Please SUBSCRIBE and stay tuned for new upcoming videos.

  • @murphytimothyl
    @murphytimothyl 7 років тому

    I am having trouble understanding where you are assigning the token to the authenticationtoken value of the webservice. Even with downloading your completed code and running it I am unable to get the following code block to return true.
    ` if (!SoapHeader.IsUserCredentialsValid(SoapHeader))
    return "Please call AuthenticationMethod() first."`
    Where do you actually push the token that you created to the cache?

    • @DotNetRevanth
      @DotNetRevanth  7 років тому

      Hi +Timothy Murphy. I have explained in the video how this token is created and cached.
      With my code you have downloaded that will authenticated with the database. Still if you doubt in completing the task ping me on fb/dotnetrevanth.
      Subscribe and stay tuned.

  • @josefidalgo78
    @josefidalgo78 7 років тому

    I tried doing this using javascript the first problem is to validate SoapHedar (if (SoapHeader == null)) because it is always null. I need to pass the username and password and get the token. How do I do this.
    Where do I keep the token for use in the various functions?

    • @DotNetRevanth
      @DotNetRevanth  7 років тому

      Try to trace or debug the communication in the browser or javascript debugger tools.
      Solution is that check whether the request is sending the SoapHeader or not.

    • @lynx8631
      @lynx8631 6 років тому

      Jose Fidalgo

  • @shravanbhadarge9746
    @shravanbhadarge9746 3 роки тому

    How to handle csrf in this?

    • @DotNetRevanth
      @DotNetRevanth  3 роки тому +1

      If you want to make it more secure. Host it in a Server which has SSL enabled. Thank you.

    • @shravanbhadarge9746
      @shravanbhadarge9746 3 роки тому

      Is there any other option to prevent CSRF attack in web service then plz suggest..Thanks

    • @DotNetRevanth
      @DotNetRevanth  3 роки тому

      Sure. I will find some alternative. Stay tuned. Subscribe the channel.

  • @fInDmEbRuh
    @fInDmEbRuh 4 роки тому

    how to logout with this??

    • @DotNetRevanth
      @DotNetRevanth  4 роки тому

      Hi +Sanjay. Token based authentication will be there at server level. So, maintain expire time in the server.
      If you really have a requirement. create one service method to clear the token cache if the token in request matches with existing token.
      Hope you got answer. Please subscribe, share the video and support me. Thank you :)

  • @IcaroCassiolato
    @IcaroCassiolato 2 роки тому

    code please