OAuth is an open-standard authorization protocol or framework that explains how unconnected servers and services may properly enable authorized access to their assets without having to share a single login credential. This is referred to as secure, third-party, user-agent, delegated authorisation in authentication jargon.
is when you go to log onto a website and it offers one or more opportunities to log on using another website’s/service’s logon. You then click on the button linked to the other website, the other website authenticates you, and the website you were originally connecting to logs you on itself afterward using permission gained from the second website.
Assume that a user has already joined up for a website or service (OAuth only works using HTTPS). The user then launches a feature/transaction that requires access to a separate site or service. The following occurs (oversimplified):
OpenID is for humans logging into machines, OAuth is for machines logging into machines on behalf of humans.
Authentication verifies that users are indeed who they claim to be. Authorization grants those users access to a resource.
Regular web apps can utilize the Authorization Code Flow (specified in OAuth 2.0 RFC 6749, section 4.1), which trades an Authorization Code for a token, because they are server-side apps with no public source code. Because you must send along your application’s Client Secret, which must always be kept safe, and you will have to keep it in your client throughout this exchange, your app must be server-side.
The Authorization Code Flow may be used by mobile and native applications during authentication, however it requires additional protection. Furthermore, single-page apps have unique problems. To address these issues, OAuth 2.0 includes a Proof Key for Code Exchange version of the Authorization Code Flow (PKCE).
The Implicit Flow is an alternative to the Authorization Code Flow that is designed for Public Clients or applications that are unable to securely hold Client Secrets. While this is no longer considered a best practice for requesting Access Tokens, it does provide a simplified workflow when combined with Form Post response mode if the application just requires an ID token for user authentication.
Instead of a user, the system authenticates and authorizes machine-to-machine (M2M) applications such as CLIs, daemons, or services operating on your backend. Authentication techniques such as username + password or social logins are ineffective in this situation. M2M apps, on the other hand, employ the Client Credentials Flow (defined in OAuth 2.0 RFC 6749, section 4.4).
Instead of immediately authenticating the user, input-constrained devices that connect to the internet ask the user to go to a URL on their computer or smartphone and approve the device. This prevents users from having a bad experience on devices that don’t have a simple way to enter text. Device apps utilize the Device Authorization Flow to do this (drafted in OAuth 2.0). For usage with mobile and native apps.
Highly-trusted apps can employ the Resource Owner Password Flow, which requires users to submit credentials (username and password) via an interactive form, however we do not encourage it. When redirect-based flows (such as the Authorization Code Flow) are unavailable, the Resource Owner Password Flow should be utilized.