What is OAuth in MVC / OAuth in MVC 5 – Very Simple explanation

OAuth in MVC ? (or) What is OAuth2 in MVC 5 ?

Before Answering the question do you have any account in Google, Microsoft, Facebook or Yahoo ?

If your answer is Yes. Then you can authenticate your website Users in your application by using these accounts instead of individual website registration.

We seen many website using Facebook, Yahoo and Google account login’s to authenticate their users. Same thing has been introduced as OAuth in MVC. It is just using Facebook, Yahoo and Google account commonly Instead of creating new accounts.

How to create OAuth authentication ? Is there any Login controls introduced like ASP.NET Login controls ?

No. While creating project you will get a button like below and you to choose this type of authentication.


OAuth in MVC 5 Authentification Change Auth

What are the Advantages you will get using OAuth in MVC 5?

  • No fresh registration is mandatory for your website. You can utilize millions of accounts which is created in Google, Microsoft, Yahoo or Facebook. Authenticate users by using these accounts.
  • No extra effort needed to implement OAuth in MVC 5. Everything is built-in.

What is open Id in MVC 5 ? what is the relation between OpenId and OAuth in MVC 5 ?

If you want to authenticate the users in your website using Google/Microsoft/Yahoo/Facebook accounts. You need to get open Id from of this.

Sample code for OAuth in MVC using Open Id

public void ConfigureOAuthentification(IAppBuilder applicationBuilder)
    applicationBuilder.UseCookieAuthentication(new CookieAuthenticationOptions
        AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie
        , LoginPath = new PathString("/UserAccount/UserLogin")

OAuth Login in MVC

It will take you to your Gmail login and once authentication done it get you back to your website.
OAuth in MVC 5 – More Interview questions and answers
OAuth in MVC 5 – asp.net more coverage on this topic.

Comments are closed.