What is OAuth
What is OAuth? OAuth is an open-standard authorization protocol or framework that describes how unrelated servers and services can safely allow authenticated access to their assets without actually sharing the initial, related, single logon credential. In authentication parlance, this is known as secure, third-party, user-agent, delegated authorization.
Give an example of what using OAuth would look like. When you sign in to a website that asks if you’d like to use your google sign in to gain access
How does OAuth work? What are the steps that it takes to authenticate the user?
- The first website connects to the second website on behalf of the user, using OAuth, providing the user’s verified identity.
- The second site generates a one-time token and a one-time secret unique to the transaction and parties involved.
- The first site gives this token and secret to the initiating user’s client software.
- The client’s software presents the request token and secret to their authorization provider (which may or may not be the second site).
- If not already authenticated to the authorization provider, the client may be asked to authenticate. After authentication, the client is asked to approve the authorization transaction to the second website.
- The user approves (or their software silently approves) a particular transaction type at the first website.
- The user is given an approved access token (notice it’s no longer a request token).
- The user gives the approved access token to the first website.
- The first website gives the access token to the second website as proof of authentication on behalf of the user.
- The second website lets the first website access their site on behalf of the user.
- The user sees a successfully completed transaction occurring.
What is OpenID? OpenID is analagous to OAuth, except that it is about authentication, rather than authorization.
Authorization and Authentication flows
What is the difference between authorization and authentication? Authentication verifies the identity of a user or service, and authorization determines their access rights.
What is Authorization Code Flow? Because regular web apps are server-side apps where the source code is not publicly exposed, they can use the Authorization Code Flow, which exchanges an Authorization Code for a token. This is what we have been doing in our .env files to allow our front end to handshake with our server and our server to handshake with APIs and Databases.
What is Authorization Code Flow with Proof Key for Code Exchange (PKCE)? PKCE is an extension to the Authorization Code flow to prevent CSRF and authorization code injection attacks.
What is Implicit Flow with Form Post? The web app requests and obtains tokens through the front channel, without the need for secrets or extra backend calls. With this method, you don’t need to obtain, maintain, use, and protect a secret in your application.
What is Client Credentials Flow? The system authenticates and authorizes the app rather than a user. For this scenario, typical authentication schemes like username + password or social logins don’t make sense. Instead, M2M apps use the Client Credentials Flow
What is Device Authorization Flow? The device asks the user to go to a link on their computer or smartphone and authorize the device.
What is Resource Owner Password Flow? Requests that users provide credentials (username and password), typically using an interactive form.