Part 1 : Token based authentication using ASP.NET Web API 2

  Рет қаралды 292,283

sourav mondal

sourav mondal

Күн бұрын

Пікірлер: 231
@claudiotalle5196
@claudiotalle5196 7 жыл бұрын
Finally a comprehensive tutorial to understand how Web API token generation works. Very valuable for me!!
@tohabin5064
@tohabin5064 4 жыл бұрын
watching in 2020 for understanding the basics of token-based authentication. It helps me a lot. thank you love from Bangladesh
@luizfredericojr
@luizfredericojr 6 жыл бұрын
Sourav, why does not anyone show the client in CSharp, making the call to the Berear generator and the other calls? I can not use PostMan inside the ASP.NET MVC 5 system! Did you happen to have a link to an article that shows the client side (in c #) accessing the web api that generates and validates the berear token?
@sonypatil19
@sonypatil19 3 жыл бұрын
Searching stop here for token based authentication.😓😓 very Helpful video. Thanks a lot.
@sachinsachan327
@sachinsachan327 3 жыл бұрын
Thanks Sir, my question is where webapi stores the token in server side?
@sarojbala11
@sarojbala11 2 жыл бұрын
Its Really Helpful for creating Token Based Web API. Thanks for creating this content.
@augustous09
@augustous09 3 жыл бұрын
People saying jwt token is containing 3 parts. Seperated by . Dots. But in the tutorial token generated without dot. Can you explain about it.
@manaswiniswain3733
@manaswiniswain3733 2 жыл бұрын
Hi, how we can get 403 forbidden error status in authenticating using oauth2?! It is a token based authentication where we pass client id, client secret and grant type as client credentials...after generation of access token to access to the protected resources one should get which status?! Can you clarify on this?!
@waqasjavaid9274
@waqasjavaid9274 5 жыл бұрын
Very helpful tutorial. I want to ask one thing about this sample application that when we send 'token' to get data. how webApi came to know that this token is valid? means how and where it checks it?. Is server has a copy of that token or what?
@christiangajo9499
@christiangajo9499 8 жыл бұрын
This video is what I'm looking for. Just a quick question, in 40:35 (grant_type) where did you set the value in the code (cs file) before calling the method
@rossmanson6524
@rossmanson6524 8 жыл бұрын
Also wondering the same
@souravmondal45
@souravmondal45 8 жыл бұрын
+Christian Gajo where I have set username and password. Here I have sent username password and grant type.
@souravmondal45
@souravmondal45 8 жыл бұрын
+sourav mondal in the js file you can see this code I have used for login fac.login = function (user) { var obj = { 'username': user.username, 'password': user.password, 'grant_type': 'password' }; Object.toparams = function ObjectsToParams(obj) { var p = []; for (var key in obj) { p.push(key + '=' + encodeURIComponent(obj[key])); } return p.join('&'); }........ Here we have added grant_type
@bl8nc
@bl8nc 5 жыл бұрын
I needed to add the two lines at the bottom of the function to get it to return the token public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { var identity = new ClaimsIdentity(context.Options.AuthenticationType); if (context.UserName == "admin" && context.Password == "123") { identity.AddClaim(new Claim(ClaimTypes.Role, "admin")); identity.AddClaim(new Claim("username", "admin")); identity.AddClaim(new Claim(ClaimTypes.Name, "Malcolm Swaine")); } else if (context.UserName == "test" && context.Password == "123") { identity.AddClaim(new Claim(ClaimTypes.Role, "test")); identity.AddClaim(new Claim("username", "test")); identity.AddClaim(new Claim(ClaimTypes.Name, "test user")); } else { context.SetError("invalid grant", "credentials are invalid"); } var ticket = new AuthenticationTicket(identity, null); context.Validated(ticket); }
@JNABrito
@JNABrito 7 жыл бұрын
When a password is passed like this 40:28 but in a regular form on a web page, is there anything preventing a sniffer from getting the password? If not, are there any known solutions for this problem (like encrypting the password in the form and decrypting later in the WebAPI when needed)?
@shyam13524
@shyam13524 3 жыл бұрын
You are saying client sends user id and password to Authentication server, so what is mean by Authentication server? which Authentication server you are saying about?
@4324234fdsfds
@4324234fdsfds 7 жыл бұрын
I really do no know . why dislikes :( . Its really nice article... It worked like charm... Thank you very much
@SaurabhKumar-nw5fy
@SaurabhKumar-nw5fy 4 жыл бұрын
I want to authenticate using SAML request with an identity provider to be initiated from an .Net Framework Web API. Do you have any article or tutorial for this?
@bahmash7735
@bahmash7735 3 жыл бұрын
Very Helpful and I fully understood the process of Token Authentication
@lr-xe2mf
@lr-xe2mf 3 жыл бұрын
How do send my token to my api consuming web application so it can authorize and have access to functions with [Authorize] above them?
@타코야끼-n6d
@타코야끼-n6d 7 жыл бұрын
Hello Sourav, Thank you for your video. I follow you video. but, I use not HandleUnauthorizedRequest Method in AuthorizeAttribute.cs, so I use OnAuthorization method and I have only return true for IsAuthenticated. I get 403. How can I to do
@ramkumar12344321
@ramkumar12344321 3 жыл бұрын
How to implement ADFS SAML Assertion Consumer with Redirct binding in .net core razor pages application? Please help
@pawankht
@pawankht 8 жыл бұрын
Excellent Job. I am waiting for the PART 2 of this series
@souravmondal45
@souravmondal45 8 жыл бұрын
kzbin.info/www/bejne/n2Oxp4SohJxopNE
@kakmca
@kakmca 5 жыл бұрын
I have generated access token for both "user" and "admin". For both of them, access_token is same. Can it happen like that?
@ProperComment
@ProperComment 7 жыл бұрын
Good work mate, thanks a ton, I tried this in Janauary but couldn't undertand, but today I have done this.
@ZahidHasan
@ZahidHasan 8 жыл бұрын
I would like to host this in IIS and access through JQuery AJAX... is that possible? I can't find the OWIN startup class.
@endatreanor5263
@endatreanor5263 4 жыл бұрын
I can hit the controller even without the bearer token. What have I missed?
@AlongOurLife
@AlongOurLife 6 жыл бұрын
Is this kind of token base authentication secure against replay attack? I am assuming because the token is valid for a certain time the request can be replayed by attacker within that time frame as it does not have nonce.
@vemareddys
@vemareddys 6 жыл бұрын
this is not working in Asp.Net Core 2.0 WebAPI ,could you please suggest how can we achieve this using Asp.netCore 2.0
@combitz
@combitz 5 жыл бұрын
Token path does not bind correctly in current ASP.NET Web API 2 so no token can be generated
@anassaleem1827
@anassaleem1827 8 жыл бұрын
how should i receive data with parameter in post form at server side?
@bijayalaxminayak7001
@bijayalaxminayak7001 4 жыл бұрын
I am follow ur process (this video /article) also Token value not came In postman 404 not found error r come How to fix it ?????
@vennkatrddyyannam3217
@vennkatrddyyannam3217 3 жыл бұрын
Saurav,, post any wcf videos, plzz
@sumangeorge7
@sumangeorge7 4 жыл бұрын
i am not getting where are you generating token. I suppose you must be using Azure AD.. but not passing any client secret key
@chenarrddelfin4042
@chenarrddelfin4042 3 жыл бұрын
can i use these api as 3rd party login api?
@rahoolmistry8137
@rahoolmistry8137 2 жыл бұрын
Please share video for refresh token in OAuth 2.0 token implementation in c#, if you have any.
@kazmirci1
@kazmirci1 6 жыл бұрын
Sourav thanks for video.Can u add refresh token part ?
@UManIsC2daK
@UManIsC2daK 7 жыл бұрын
Hey, great tute! thanks! How would the "logout" mechanism work? Or do we have to rely on token expiration?
@souravmondal45
@souravmondal45 7 жыл бұрын
In OAuth there is no option for signout. we can Delete the access token on the client. But 1 more option we have... that is if you want then you can save the token in a database table and check with that table data when a request come.
@mujtabakiani6592
@mujtabakiani6592 3 жыл бұрын
When I try to generate token after all this process I am getting 404 error. localhost:44383/token. it returns 404
@Ashish-gg3pr
@Ashish-gg3pr 7 жыл бұрын
{ "Message": "No HTTP resource was found that matches the request URI 'localhost:54473/token'.", "MessageDetail": "No type was found that matches the controller named 'token'." } getting this error while do post further things work properly can you solve this issue
@shivakumarshirke6625
@shivakumarshirke6625 4 жыл бұрын
When I tried to implement Google sign on in aap.net Web API and angular frontend framework am getting redirect uri mismatch as error can you please help me to resolve this issue
@Gurmeet2010mca
@Gurmeet2010mca 7 жыл бұрын
Hello Sourav Mondal plz explain when we enter username and password,then token generate,where this token is stored, to validate the next request
@devkranthkishorevanja890
@devkranthkishorevanja890 7 жыл бұрын
HI Sourav..That was a great tutorial about Token based authentication. i tried out the way you have explained. but when i create the token and try to access the Authenication , the response i get is forbidden.So i removed the ! in "HttpContext.Current.User.Identity.IsAuthenticated" and i get the response as hello "dev". Is the the corrrect way of doing? and one more question i created a token for the admin user and tried to access the "Authenitcate" Method.Should it access or not? For me i was able to access? Correct me if am wrong?
@Spiritak
@Spiritak 6 жыл бұрын
Thank You, i was trying to make this for 2 days and thanks to your video it is finally working!
@sarjukabariya1223
@sarjukabariya1223 8 жыл бұрын
It's great... thank you so much, Actually I am new for ASP.Net identity, and I want to know that in above demo where the users identity details like roles, claims etc are stored ? in memory, database or somewhere else ? And one more thing I want to refresh token after token get expired then what I have to do? Any reference for refreshing token.
@annupatel7316
@annupatel7316 6 жыл бұрын
hello can we give error code with error message in all cases , if we pass wrong token ten only one JSON response will with message parameter. but we need error code, if token is expire then we need an other response and error code. please update me sir
@parthintwala2162
@parthintwala2162 3 жыл бұрын
Can I use this for .net core 3.1, Web API solution? Need urgent help.
@souravmondal45
@souravmondal45 3 жыл бұрын
yes you can use
@parthintwala2162
@parthintwala2162 3 жыл бұрын
@@souravmondal45 Thank You, but after installing the nuget packages, I am getting the warning that those nuget packages may not be compatible with .net core 3.1. I hope that's fine, is it?
@TrivenSharma
@TrivenSharma 8 жыл бұрын
Many many thanks for creating this superb video... one suggestion here, it would be nice for a starter to get more details about the classes/references you have added in this project.
@garvitkarnwal7017
@garvitkarnwal7017 7 жыл бұрын
getting error unsupported grant type even in the demo code also. :(
@anupniit
@anupniit 3 жыл бұрын
Getting error while running on shared hosting.403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied.
@khaledsaleh4238
@khaledsaleh4238 7 жыл бұрын
Very good explanation Sourav. Do we need to persist the generated token in a Database that way we can always check if it expires or not?.
@souravmondal45
@souravmondal45 7 жыл бұрын
yes are right.
@khaledsaleh4238
@khaledsaleh4238 7 жыл бұрын
Thanks Sourav. Another question I have please, In the tutorial you used Bearer authentication, in my case I want the client of my API just send the token and I can validate it against the token I have on the database. Is there another type of Authentication or shall I keep it as simple as get the token from the header and compare it to the token in the DB?.
@wilmanherrera5281
@wilmanherrera5281 7 жыл бұрын
Hello Sourav. I have a question. I need implement Two-Factor Authentication into Authentication logic. How could I do it??? I need a lot of ideas....
@8787Sergei
@8787Sergei 5 жыл бұрын
Hello! how to send token from mvc?
@ameysaitavdekar4102
@ameysaitavdekar4102 4 жыл бұрын
Great Tutorial.Explanation was upto the mark.
@sivamurugan8304
@sivamurugan8304 2 жыл бұрын
Super video sourav, i have a doubt , when i hit from my apicontroller as specified in below code, var tokenresponse = await objhttpclient.PostAsync(baseurl + "/token", new FormUrlEncodedContent(form)); whether it wll hit Applicationoauthprovider class grantresourceownercredentials()? Anybody has idea to solve the above myth?
@NaveenChandraPathak
@NaveenChandraPathak 8 жыл бұрын
where the user tokens are stored ??
@amaramarnathreddy4445
@amaramarnathreddy4445 6 жыл бұрын
same code implement and testing postman on authorization to get token given username,password and grant_type but getting error "Invalid client" please any suggestion to slove
@mohammadassad6306
@mohammadassad6306 6 жыл бұрын
getting the same error for me too.!! any suggestion to solve please
@ProperComment
@ProperComment 7 жыл бұрын
I m getting stuck at 24:21 cant see the method HandleUnauthorizedReqest Cant see t
@Eric-iq9xk
@Eric-iq9xk 6 жыл бұрын
Use OnAuthorization method and then: if (HttpContext.Current.User.Identity.IsAuthenticated){base.OnAuthorization(actionContext);}else ....
@Amol175
@Amol175 7 жыл бұрын
How to authenticate two different types of user like admin and customers
@jyotipaliwal3141
@jyotipaliwal3141 7 жыл бұрын
Hi, Tussi gr8 simple & gr8 ho btw, what overall I understood that if you are applying 3 leg authentication than this part (of authentication and providing the access token) will be with 3rd party authorization provider like gmail or facebook. Correct?
@ganirban82
@ganirban82 7 жыл бұрын
Hlw Jyoti, U can use a third party STS(authentication server) app like "identityserver3" to urs project. "identityserver3" supports other social logins like FB, GMAIL. Pls chk the web link below www.scottbrady91.com/Identity-Server/Identity-Server-3-Standalone-Implementation-Part-1
@khwong98
@khwong98 5 жыл бұрын
Great presentation and illustration.
@sangthanh2490
@sangthanh2490 7 жыл бұрын
It is very helpful for me. But can you guide for me how to built a form Login use Token based authentication and only jquery because my boss do not want to use postman and AngularJS. Thank you so much
@aaronedwards1017
@aaronedwards1017 6 жыл бұрын
Works like a charm. However, I have a problem. We are integrating Help Pages into our application (docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages). We need to be able to restrict access to the help page to only logged in users. I added ASP.NET Identity to accomplish this. But it seems that the ASP.NET Identity classes (ApplicationUserManager, ApplicationSigninManager etc.) don't play nice with Owin classes in this tutorial. To see what I mean, add a webapi help page using the above link, then try to lock down that controller with [Authorize].
@JoseGomez-qw2gi
@JoseGomez-qw2gi 7 жыл бұрын
Can you help me? I'm trying to add a method POST to your app but my value always is null, all method GET works fine this is the method. Need I move something on the Startup? [HttpPost] [Route("api/cobro/saveEmail/{email}")] public IHttpActionResult SaveEmailForDiscount( string email) { //do something with e-mail return Ok(email); }
@arulmanivannan9130
@arulmanivannan9130 7 жыл бұрын
try putting api/cobro/saveEmail?email=sample@email.com this will be a temporary fix as u need to check on routing for permanent fix
@shahidwani6445
@shahidwani6445 7 жыл бұрын
can u please make videos on how to implement iprincipal
@Rahulsapkota
@Rahulsapkota 7 жыл бұрын
Please make a client app and call all the methods from client app. Because when i tried to call token method it's throwing me error of cors.
@modnystyl2013
@modnystyl2013 7 жыл бұрын
Very good and well explained tutorial for everybody which needs helps with TOKEN authentication. Step by step explained. Thank You!
@callegarip
@callegarip 8 жыл бұрын
Nice video tutorial. I am having a problem everything works except when I request a token. When I put in Postman the localhost:port/token, it return the html of my site. The status is 200 OK. But I do not see the access token json. What do you think I am missing? Thanks
@happysoul1156
@happysoul1156 3 жыл бұрын
Even same error I am facing now
@kuhan1870
@kuhan1870 7 жыл бұрын
Hello from the UK, nice video, step by step, very useful :)
@SureshKumar-cj9iz
@SureshKumar-cj9iz 5 жыл бұрын
Good post for static(explicit) data. Can you please put a post for dynamic(implicit) data i.e., retrieving data from the database using Token based authentication in ASP.NET Web API .
@souravmondal45
@souravmondal45 5 жыл бұрын
I have shown you with the static data for making the tutorial simple and easy to understand. You can just write query for fetching data from database here in the GrantResourceOwnerCredentials method.
@SureshKumar-cj9iz
@SureshKumar-cj9iz 5 жыл бұрын
@@souravmondal45 Oh, thank you!
@kassemsirine385
@kassemsirine385 5 жыл бұрын
Thank you so much this worked perfectly for me, but I'm blocked on how to use this method using data retrieved from a Login View that i created instead of using Postman. I really hope you can explain that part
@manikantameduri3654
@manikantameduri3654 5 жыл бұрын
could you please provide the link of part 2 of this video?
@souravmondal45
@souravmondal45 5 жыл бұрын
kzbin.info/www/bejne/n2Oxp4SohJxopNE
@vinodcd
@vinodcd 7 жыл бұрын
Thank you very much Sourav. I was researching on this and your video has everything I'm looking for to get a start.
@muhallidinwali4838
@muhallidinwali4838 8 жыл бұрын
I got error { "error":"unsupported_grant_type"} Can u please help me on this
@arulmanivannan9130
@arulmanivannan9130 7 жыл бұрын
Am also facing this issue, would be very helpful if @sourav mondal sir guides.
@UriGolberg
@UriGolberg 2 жыл бұрын
@@arulmanivannan9130 @sourav Did you solve the problem?
@arulmanivannan9130
@arulmanivannan9130 2 жыл бұрын
@@UriGolberg yes. Pls see my other comment here
@ehsankeshtgar6734
@ehsankeshtgar6734 4 жыл бұрын
Hi , Thanks for the video . I've implemented your solution , however when I run token url , I get the error " invalid_grant" . could you please advise how to resolve it ?
@souravmondal45
@souravmondal45 4 жыл бұрын
as per the tutorial, invalid_grant should came only when GrantResourceOwnerCredentials fails to validate user credential. please recheck the code where you are validating user credential.
@ehsankeshtgar6734
@ehsankeshtgar6734 4 жыл бұрын
@@souravmondal45 Thanks mate. I was omitting one line of your code . It's working fine now . I have another question that you might know the answer though . I have a website that uses Microsoft login functionality. So user needs to put his office 365 credentials in microsoft popup to login. I want to expose the WEB APPs in this website, however when I call these APIs via postman, it fails . The response is the same html of microsoft login , so it actually asks for Microsoft login credentials even through postman . Do you know if there is any way to expose such APIs ? Very thanks in advanced.
@shahidwani6445
@shahidwani6445 7 жыл бұрын
How to do same in .net core 2.0 web api
@shrikantchavan6856
@shrikantchavan6856 8 жыл бұрын
very nice explanation, please provide 2nd part asap.
@souravmondal45
@souravmondal45 8 жыл бұрын
kzbin.info/www/bejne/n2Oxp4SohJxopNE
@HemantKumar-yk2jk
@HemantKumar-yk2jk 8 жыл бұрын
Dear Saurav, I am getting below error while executing request using postman tool. i am not sure what i need to check here. ******************************************************************************** Value cannot be null. Parameter name: value body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } @media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } @media screen and (max-width: 479px) { pre { width: 280px; } } Server Error in '/' Application. Value cannot be null. Parameter name: value Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: value Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentNullException: Value cannot be null. Parameter name: value] System.IO.BinaryWriter.Write(String value) +11476865 Microsoft.Owin.Security.DataHandler.Serializer.TicketSerializer.Write(BinaryWriter writer, AuthenticationTicket model) +97 Microsoft.Owin.Security.DataHandler.Serializer.TicketSerializer.Serialize(AuthenticationTicket model) +161 Microsoft.Owin.Security.DataHandler.SecureDataFormat`1.Protect(TData data) +45 Microsoft.Owin.Security.Infrastructure.AuthenticationTokenCreateContext.SerializeTicket() +16 Microsoft.Owin.Security.OAuth.<InvokeTokenEndpointAsync>d__22.MoveNext() +4114 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +11522180 Microsoft.Owin.Security.OAuth.<InvokeAsync>d__0.MoveNext() +1109 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 Microsoft.Owin.Security.Infrastructure.<Invoke>d__0.MoveNext() +383 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 Microsoft.Owin.Cors.<Invoke>d__0.MoveNext() +691 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d__5.MoveNext() +187 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<DoFinalWork>d__2.MoveNext() +185 Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +69 Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +64 System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +380 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0
@arulmanivannan9130
@arulmanivannan9130 7 жыл бұрын
Check the references have been added properly from nuget packages sir.
@Naveen-qy2hw
@Naveen-qy2hw 6 жыл бұрын
mistake at 38:42 returns 401 Unauthorized not 403 because you created Aurthorize attribute with the same of framework, so it consider it as framework of default behaviour...you should change the different name for your CustomAuthorize inheritance form Authorize attribute. update it as early as atleast patch video
@charankumarc7305
@charankumarc7305 4 жыл бұрын
Thanks so much .u good teach .Every one understand easily.good job sir
@kstudio368
@kstudio368 5 жыл бұрын
how about refresh token?
@cosmarvv5000
@cosmarvv5000 4 жыл бұрын
Very good explanation. Thanks
@loknadh6969
@loknadh6969 6 жыл бұрын
Hi Sourav. grate tutorial. I have issue. every time I getting 403 forbidden error (api/data/authenticate call) even I am giving proper token (after token call). Please help me out.
@Eric-iq9xk
@Eric-iq9xk 6 жыл бұрын
In AuthorizeAttribute.cs, use OnAuthorization method and then: if (HttpContext.Current.User.Identity.IsAuthenticated){base.OnAuthorization(actionContext);}else ....
@govindkumar-iu4jh
@govindkumar-iu4jh 6 жыл бұрын
how can validate user on client side
@def3980
@def3980 7 жыл бұрын
How can logout with this implementation? You hav an example??
@souravmondal45
@souravmondal45 7 жыл бұрын
Just delete your token. You can see the next part of this video kzbin.info?o=U&video_id=i2NvQrO75no Here I have done all.
@walugembe
@walugembe 4 жыл бұрын
Thanks for this straightforward example. I've learnt a lot.
@ronyrodriguez4472
@ronyrodriguez4472 7 жыл бұрын
Microsoft.Owin 3.1.0 is not compatible with netcoreapp1.0
@GiovanniPerri
@GiovanniPerri 4 жыл бұрын
Thank you so much for the valuable information, with your help I solved a difficult situation.
@amansingh4646
@amansingh4646 4 жыл бұрын
Awesome video bro
@riyayoutuber9126
@riyayoutuber9126 Жыл бұрын
Microsoft.Web.Services3.Security.SecurityFault: The security token could not be authenticated or authorized ---> System.InvalidOperationException: WSE563: The computed password digest doesn"t match that of the incoming username token. at Microsoft.Web. ........??how to solve this problem ???
@sameer795
@sameer795 7 жыл бұрын
i am getting {"error": "invalid_grant"} even though it never reaches the block to set the error.
@souravmondal45
@souravmondal45 7 жыл бұрын
have you passed grant_type="password" parameter?
@sameer795
@sameer795 7 жыл бұрын
I actually missed to pass the user to validate, that's why I was unable to login.. By the way, thanks for the great tutorial.. Helped me understand that sometimes I need to look places
@souravmondal45
@souravmondal45 7 жыл бұрын
Welcome. Thanks for watching my videos. Keep watching for more useful videos.
@rajthakur3307
@rajthakur3307 7 жыл бұрын
can we use oauth2.0 with jwt(json web token)
@ganirban82
@ganirban82 7 жыл бұрын
Hlw Raj, We can use IdentityServer3 app. This third party app(Written on asp.net-webApi) is already implemented Oauth2(authorization) and OpenId(Authentication) for token based Authentication-authorization process for client like server tech , or browser agent tech application. Pls chk the below web link. www.scottbrady91.com/Identity-Server/Identity-Server-3-Standalone-Implementation-Part-1
@arulmanivannan9130
@arulmanivannan9130 7 жыл бұрын
Kind help required sir, am getting invalid_grant error in postman. Also can someone help?
@arulmanivannan9130
@arulmanivannan9130 7 жыл бұрын
Made a silly error by not passing identity in context.Validated() method @40:13. Sorry. Your tutorial is working like charm.
@anabel845
@anabel845 3 жыл бұрын
Thank you so much. Make vdo about refresh Token please!
@krr4483
@krr4483 8 жыл бұрын
hi sir,can you please upload token based authentication using web api with database as soon as possible Thnaking You
@SunilMehta131
@SunilMehta131 7 жыл бұрын
Good video, It would have been even better if you'd explained things a little more like AuthServerProvider class and its functions, what are all other methods, when to use what. How to setup it with SSL because that's what we will use in the real world.
@bl8nc
@bl8nc 5 жыл бұрын
Thanks for the video! I was receiving {invalid-grant} even after auth success. At 40: 13 I needed to add var ticket = new AuthenticationTicket(identity, null); context.Validated(ticket); at the end of the GrantResourceOwnerCredentials method to get it to return a token
@suppumahendra8304
@suppumahendra8304 5 жыл бұрын
Hi,its good information, could you please provide one more video for "Token based authentication using asp/net web api and angular 6
@souravmondal45
@souravmondal45 5 жыл бұрын
kzbin.info/www/bejne/n2Oxp4SohJxopNE
@shashisagarshrestha1410
@shashisagarshrestha1410 2 жыл бұрын
how to convert jwt authentication.
@radhasimgh1528
@radhasimgh1528 4 жыл бұрын
good knowledge you have shared.thanks
@farooqahmed1552
@farooqahmed1552 3 жыл бұрын
Gr8 SirJee ! really appreciated.
@ananthr8648
@ananthr8648 8 жыл бұрын
Nice video ..can please tell me where i can set (grant_type) bcoz i am getting bad Request
@souravmondal45
@souravmondal45 8 жыл бұрын
+Ananth r in the js file you can see the below code I have used for login , here we have added grant_type fac.login = function (user) { var obj = { 'username': user.username, 'password': user.password, 'grant_type': 'password' }; Object.toparams = function ObjectsToParams(obj) { var p = []; for (var key in obj) { p.push(key + '=' + encodeURIComponent(obj[key])); } return p.join('&'); }..........
@syedqayyumsyedyusuf2140
@syedqayyumsyedyusuf2140 7 жыл бұрын
looks like you are reading it from paper... but it was helpful thanks..
@sarjukabariya1223
@sarjukabariya1223 8 жыл бұрын
I am waiting for AngularJs2 with same autnetication implementation.
@benjaminlizarraga7926
@benjaminlizarraga7926 7 жыл бұрын
Sarju Kabariya me too
Part 2 : Token Based Authentication Using ASP.NET Web API in AngularJS
1:01:03
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Token Based Authentication in Web Service Asp.Net c# || Part-11
25:46
DotNet Revanth
Рет қаралды 53 М.
ASP.NET Core Authentication with JWT  (JSON Web Token)
26:09
DotNet Core Central
Рет қаралды 163 М.
What Is A RESTful API? Explanation of REST & HTTP
18:38
Traversy Media
Рет қаралды 1,4 МЛН
Why ASP.NET MVC and MVC vs WebForms ? ( Learn MVC  5 series)
28:57
.NET Interview Preparation videos
Рет қаралды 249 М.
Web API CRUD Operations Using Asp Net MVC and Entity Framework
45:55
Adding an OAuth 2.0 Security Scheme to an ASP.NET Core 5 API
17:19
Thomas Clark
Рет қаралды 19 М.