Skip to content

Latest commit

 

History

History
126 lines (53 loc) · 7.13 KB

File metadata and controls

126 lines (53 loc) · 7.13 KB

What is OAuth?

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.

  1. 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.

  2. when a user sending cloud-stored files to another user via email, when the cloud storage and email systems are otherwise unrelated other than supporting the OAuth framework (e.g., Google Gmail and Microsoft OneDrive). When the end-user attaches the files to their email and browses to select the files to attach, OAuth could be used behind the scenes to allow the email system to seamlessly authenticate and browse to the protected files without requiring a second logon to the file storage system.

How does OAuth work? What are the steps that it takes to authenticate the user?

  1. The first website connects to the second website on behalf of the user, using OAuth, providing the user’s verified identity.

  2. The second site generates a one-time token and a one-time secret unique to the transaction and parties involved.

  3. The second site generates a one-time token and a one-time secret unique to the transaction and parties involved.

  4. The client’s software presents the request token and secret to their authorization provider (which may or may not be the second site).

  5. 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.

  6. The user approves (or their software silently approves) a particular transaction type at the first website.

  7. The user is given an approved access token (notice it’s no longer a request token).

  8. The user gives the approved access token to the first website.

  9. The first website gives the access token to the second website as proof of authentication on behalf of the user.

  10. The second website lets the first website access their site on behalf of the user.

  11. The user sees a successfully completed transaction occurring.

  12. OAuth is not the first authentication/authorization system to work this way on behalf of the end-user. In fact, many authentication systems, notably Kerberos, work similarly. What is special about OAuth is its ability to work across the web and its wide adoption. It succeeded with adoption rates where previous attempts failed (for various reasons).

What is OpenID?

  • OpenID is about authentication

  • OpenID is for humans logging into machines, OAuth is for machines logging into machines on behalf of humans.

  • rather than having multiple logins for multiple websites, OpenID would serve as a single sign-in, vouching for the identities of users.

Is OAuth safe?

\ Coders and users should look to ensure that OAuth is running inside of TLS protection. Developers can implement code to enforce TLS use and users should be aware that TLS (Transport Layer Security) is being used whenever they are begin asked to input authentication credentials

Because of the lack of inherent security binding, it’s possible for a rogue website to phish a user’s legitimate credentials during the part of the process where the user is being required to authenticate themselves to the authorization provider. For example, a user is using the first service and chooses a feature that forces an OAuth transaction to a second service. It’s possible for the first website to fake the second website, where user authentication is often taking place. The rogue website can then collect the user’s authentication credentials and react as if the OAuth transaction had successfully taken place.


Authorization and Authentication flows

Authorization and Authentication flows

What is the difference between authorization and authentication?

  • Authentication is the process of verifying who a user is

  • Authorization is the process of verifying what they have access to.

difference between authorization and authentication

What is Authorization Code Flow?

  1. The user clicks Login within the regular web application.

  2. Auth0's SDK redirects the user to the Auth0 Authorization Server (/authorize endpoint).

  3. Your Auth0 Authorization Server redirects the user to the login and authorization prompt.

  4. The user authenticates using one of the configured login options and may see a consent page listing the permissions Auth0 will give to the regular web application.

  5. Your Auth0 Authorization Server redirects the user back to the application with an authorization code, which is good for one use.

  6. Auth0's SDK sends this code to the Auth0 Authorization Server (/oauth/token endpoint) along with the application's Client ID and Client Secret.

  7. Your Auth0 Authorization Server verifies the code, Client ID, and Client Secret.

  8. Your Auth0 Authorization Server responds with an ID Token and Access Token (and optionally, a Refresh Token).

  9. Your application can use the Access Token to call an API to access information about the user.

  10. The API responds with requested data.

What is Authorization Code Flow with Proof Key for Code Exchange (PKCE)?

Authorization Code Flow with Proof Key for Code Exchange (PKCE)

What is Implicit Flow with Form Post?

you obtain an ID token using authorization code flow performed by the app backend. This method is effective and robust, however, it requires your web app to obtain and manage a secret. You can avoid that burden if all you want to do is implement sign-in and you don’t need to obtain access tokens for invoking APIs.

What is Client Credentials Flow?

With machine-to-machine (M2M) applications, such as CLIs, daemons, or services running on your back-end, the system authenticates and authorizes the app rather than a user.

What is Device Authorization Flow?

With input-constrained devices that connect to the internet, rather than authenticate the user directly, the device asks the user to go to a link on their computer or smartphone and authorize the device. This avoids a poor user experience for devices that do not have an easy way to enter text. To do this, device apps use the Device Authorization Flow (ratified in OAuth 2.0), in which they pass along their Client ID to initiate the authorization process and get a token.