Topics
Published on December 8, 2016 by kudvenkat

In this video we will discuss how to use bearer token for authentication and retrieving data from the server.

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-tutorials.blogspot.com/2016/12/web-api-bearer-token-example.html

Slides
csharp-video-tutorials.blogspot.com/2016/12/web-api-bearer-token-example_8.html

All ASP .NET Web API Text Articles and Slides
csharp-video-tutorials.blogspot.com/2016/09/aspnet-web-api-tutorial-for-beginners.html

All ASP .NET Web API Videos

All Dot Net and SQL Server Tutorials in English
www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd

All Dot Net and SQL Server Tutorials in Arabic
www.youtube.com/c/KudvenkatArabic/playlists

Leave a Reply

22 Comments on "Web api bearer token example"

Notify of
avatar

Yiannis Ioannidis
Guest
Yiannis Ioannidis
10 months 14 days ago

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.

Narayanan Mankore
Guest
Narayanan Mankore
11 months 5 days ago

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.

Ali Hassan
Guest
Ali Hassan
1 year 1 month ago

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….

Ali Hassan
Guest
Ali Hassan
10 months 11 days ago

i will check whether it works for me or not…by the way thanks…for giving your solution

Harshita Chambhare
Guest
Harshita Chambhare
10 months 13 days ago

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

Harshita Chambhare
Guest
Harshita Chambhare
10 months 13 days ago

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

Ali Hassan
Guest
Ali Hassan
1 year 2 days ago

Sorry ! Not Yet

Ali Hassan
Guest
Ali Hassan
1 year 9 days ago

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

Dioseb
Guest
Dioseb
1 year 9 days ago

I have the same error, did you solve it ?

Velkumar Santhanaraj
Guest
Velkumar Santhanaraj
1 year 1 month ago

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?

Kiran Dhere
Guest
Kiran Dhere
1 year 1 month ago

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

ytfilastu
Guest
ytfilastu
1 year 1 month ago

gr8

Al Belarmino
Guest
Al Belarmino
1 year 1 month ago

Thanks Dude. 🙂

Guereiro Chuze
Guest
Guereiro Chuze
1 year 1 month ago

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

Chintan panchal
Guest
Chintan panchal
1 year 1 month ago

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

Rk215 Tech
Guest
Rk215 Tech
1 year 1 month ago

how can I use this type of message " session expired" . I like this message box . I new in asp.net. . so tell me how to use can I use message box????????.

wpDiscuz