Web api bearer token example

Поділитися
Вставка
  • Опубліковано 6 лют 2025
  • In this video we will discuss how to use bearer token for authentication and retrieving data from the server.
    Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our UA-cam channel. Hope you can help.
    / @aarvikitchen5572
    We want to implement a page that retrieves employee data from the server. If the user is not authenticated, he should be automatically redirected to the login page. The user should be able to get to the data page, only if he is logged in.
    At the moment, the only way to log off the user is by closing the browser window. As we are storing the bearer token in browser session storage, when we close the browser we loose it from the session. In our next video we will discuss, how to explicitly log out the user without closing the browser window.
    Text version of the video
    csharp-video-tu...
    Slides
    csharp-video-tu...
    All ASP .NET Web API Text Articles and Slides
    csharp-video-tu...
    All ASP .NET Web API Videos
    • ASP.NET Web API tutori...
    All Dot Net and SQL Server Tutorials in English
    www.youtube.co...
    All Dot Net and SQL Server Tutorials in Arabic
    / kudvenkatarabic

КОМЕНТАРІ •

  • @Lolitalein
    @Lolitalein 6 років тому +1

    Thank you! Thank you! Thank you!
    Your videos are a massive help for my university project. With your guidance I was able to get everything working
    Greetings from Germany

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

    kudvenkat dear my brother you are the best. greeting from turkey

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

    Nice lessons provided by you in different concepts, keep going and help us as usual, Big Thank you!

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

    Superb video with succinct explanation.

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

    THANK YOU PRAGIM,
    You are doing your best and helping i mean Teaching Many of us, how to programming.
    In my Language i say: MUITO OBRIGADO

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

    Yeah..Yo videos is great sir..4 moving 4ward..in d career life. .
    Bt,
    Nt looking d clearly videos in Android mobile sir.

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

    Great video. Thank you.l

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

    I like your tutorials very much, nice job

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

    11:47 I thought it should be tblBody and not tblData. But I found that both of them will put the rows inside tbody. jQuery magic!

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

    Hi, great video as always. Please continue with web api. Can you make a video using JWT (JSON web token) between client and server. Thanks!

  • @abdirahmanmohamud5855
    @abdirahmanmohamud5855 5 років тому +3

    please sir i need refresh token demo thanks you are more helpful

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

    it was excellent

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

    NIce Video.. Can we you please make a video of bearer token with .NET CORE

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

    Plzz make C C++ Programming Tutorials You're tutorial so nice easy to understand....

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

    thanks alot my pro

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

    Hello, My understanding on Web API is that its stateless http protocol. But here we do use sessionStorage to use / identify sessions. Is it violating RESTFUL service principles ? Can you please clarify ? If my question is irrelevant please ignore.

  • @vijaybhatt143
    @vijaybhatt143 5 років тому +1

    Thank you for the video but in last you forgot to tell to remove authorized from controller. I was getting unauthorized error..

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

      You should not remove authorized. If you are getting 401 error make sure that you have space after to Bearer (inside the string)

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

    The word "thank you" is very little compared to what you offer to all of us.
    Can anyone please tell in which table is stored the Bearer token in the server side, and is able to authenticate the client ?
    Thank you very much in advance.

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

    How the token value is differentiated from user, can 2 user from 2 different machine pass the same token in the Authorization header for calling 1 api?

  • @haseebjeelaniify
    @haseebjeelaniify 6 років тому +1

    I have been running this example with visual studio 2015 community edition but token request has been working fine with Fiddler and when using access_token with other request like employee Get method it has been working with Fiddler but when calling as per given example it shows error. Can someone help me out in resolving this issue.

  • @jameswillson7130
    @jameswillson7130 8 років тому +7

    The gender pay gap is real at kudvenkat industries

    • @testpayman3446
      @testpayman3446 6 років тому +2

      Why does that bother everyone so much? The pay gap may be due to the positions and experience they hold.

  • @hk_build
    @hk_build 6 років тому +2

    how server validates user token for particular user for 2nd request ...where token will be saved in server..?

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

      Token wont be saved at server side but did you able to figure it out how Token is getting validated at server side on second request ?

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

      @@ksksai if client is sending token how server will come to know its same client
      there has to be validation right...
      by the way am UI dev ...so not much into server side
      let me know if you know ...

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

    Thanks Dude. :)

  • @danishhabib3495
    @danishhabib3495 5 років тому +1

    it is headers not header that might be your mistake :)

  • @Chintanpanchalprime
    @Chintanpanchalprime 8 років тому +3

    Hello, can you please tell us how to upload multiple file using web api.

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

      have you find the answer? please share with us.

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

    gr8

  • @chiraggupta7063
    @chiraggupta7063 4 роки тому +1

    Hello Sir,
    Actually I have written the same code but still i am getting error message on data.html page i also tried to access this page after login but again facing same issue even i checked the value of access Token it was same
    Please help me to resolve this issue

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

    Respected Sir, it working fine but how to send token when requesting from MVC Controller to API Controller ? Without Using Ajax

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

    Is this code same for asp.net core?

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

    THANKS THANKS THANKS

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

    Sir please tell me how to decorate the EmployeeContrioler GET method for this video which you retrive data from the controler username and password ( part 25 )

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

    can u provide the whole code, it is little bit confusing?

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

    Hi,
    How do refresh my token on every request.
    For Instance.
    In my API i have set expired token as 5 mins for an example, even though I'm using my web page continuously without being idle my token will be expired after 5 mins.
    How do we resolve this, meaning how do i refresh token on every request or is there any way to handle this?

  • @sayedmd.atiqurrahman1760
    @sayedmd.atiqurrahman1760 7 років тому

    Hi, I made a separate location for the JS file and then added location in BundleConfig.cs. Now, If I reload data.html page and set a breakpoint at " if (sessionStorage.getItem('accessToken') == null) { window.location.href = "Login.html"; }", the step passes this condition for infinity times and as a result login page also refreshes infinity times. Could you please let me know the reason?

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

    I am facing a problem which is not related to this topic. Actually, I was trying to host this Web API service on the IIS. I can access Login.html, Registration.html, Data.html pages from debugging mode. But after adding this service (publish) on the IIS I could not access those pages, it appears as a blank page. In browser console it's showing me this error message "Unchecked runtime.lastError: Could not establish the connection. Receiving end does not exist.". Does anyone know this issue or what I am doing wrong here? Thanks in advance.

  • @KuldeepKumar-nk2jo
    @KuldeepKumar-nk2jo 5 років тому

    how to generate "Refresh token" and "Access Token" ?

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

    Thank you sir

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

    Hi all, Please anyone let me know how the Token is getting validated at server side when we click on Load Employee button ?

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

    I logged in with the credentials and when I clicked on LoadEmployees button why it says {"Message":"Authorization has been denied for this request."}

    • @subhashpandey6035
      @subhashpandey6035 6 років тому +1

      var token = sessionStorage.getItem('accessToken');
      var headers = {};
      if (token) {
      headers.Authorization = 'Bearer ' + token;
      }
      $('#btnLoadHospital').click(function () {
      $.ajax({
      url: '/api/HospitalUser',
      method: 'GET',
      headers: headers,
      success: function (data) {

    • @hasangalakdinu
      @hasangalakdinu 5 років тому +3

      you should consider in Authorization Header 'Bearer ',you should keep a space 'Bearer ' not 'Bearer'

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

      @@subhashpandey6035 VERY helpful, thank you so much.

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

    Hello..sir,
    Yo videos r nt displaying clearly.

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

    when i logged in i click on load employees and modal popups your session expired please login again ...and it came back to login page ...i have properly check timespan.fromseconds(10)...but dont know why it is happening... Please Help me...anyone....

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

      I have the same error, did you solve it ?

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

      No ....i have finally left this...and move to next video series....may be you may help me...please let me know if you finally done this...thnx in advance

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

      Sorry ! Not Yet

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

      I have same error wasted 2-3 hours couldnt find solution :-(
      let me know if you find the solution

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

      Hi again,
      when I used localStorage instead of sessionStorage it worked