What's the difference between passport and oauth? What's the difference between passport and oauth? express express

What's the difference between passport and oauth?


Passport is authentication middleware.OAuth is authorization middleware.

To understand the difference:

Authentication is the process of ascertaining that somebody really is who he claims to be.

Authorization refers to rules that determine who is allowed to do what. E.g. Bob may be authorized to create and delete databases, while Bobbette is only authorized to read.

In other words. Authentication is your username + password. Authorization is what you're allowed to do.

Passport will allow you to authenticate the user before allowing access to your API. It does not (directly, it's possible) allow to check if a user is allowed to perform an action after authentication.

Check this Wikipedia for more on Authentication vs Authorization.

What OAuth does that Passport doesn't, is that it allows users to grant a service access to their personal information. It also allows users to allow or disallow certain privilages (scopes in OAuth).

Do note that there are a lot of OAuth flavors. The most common is the version with authorization grant types seen when authorizing with Facebook or Google. But there are many others including the Resource Owner Password strategy you mentioned.