ChatGPT解决这个技术问题 Extra ChatGPT

What exactly is OAuth (Open Authorization)?

What exactly is OAuth (Open Authorization)?

I have gleaned some information from

OAuth

Twitter Tutorial: What is OAuth And What It Means To You

What is OAuth

But I want to learn and know more. I'm looking for info on the lifecycle. Why do most of the social networks rely on this open protocol?

Will it become a de facto in near future with the various technologies (e.g. ASP.NET)?

rfc-editor.org/rfc/inline-errata/rfc5849.html Try 1.2. Example and if it helps to understand it better.

u
user1767316

What exactly is OAuth (Open Authorization)?

OAuth allows notifying a resource provider (e.g. Facebook) that the resource owner (e.g. you) grants permission to a third-party (e.g. a Facebook Application) access to their information (e.g. the list of your friends).

If you read it stated plainly, I would understand your confusion. So let's go with a concrete example: joining yet another social network!

Say you have an existing Gmail account. You decide to join LinkedIn. Adding all of your many, many friends manually is tiresome and error-prone. You might get fed up halfway or insert typos in their e-mail address for the invitation. So you might be tempted not to create an account after all.

Facing this situation, LinkedIn™ has the good idea to write a program that adds your list of friends automatically because computers are far more efficient and effective at tiresome and error-prone tasks. Since joining the network is now so easy, there is no way you would refuse such an offer, now would you?

Without an API for exchanging this list of contacts, you would have to give LinkedIn the username and password to your Gmail account, thereby giving them too much power.

This is where OAuth comes in. If your GMail supports the OAuth protocol, then LinkedIn can ask you to authorize them to access your Gmail list of contacts.

OAuth allows for:

Different access levels: read-only VS read-write. This allows you to grant access to your user list or bi-directional access to automatically synchronize your new LinkedIn friends to your Gmail contacts. Access granularity: you can decide to grant access to only your contact information (username, e-mail, date of birth, etc.) or to your entire list of friends, calendar and whatnot. It allows you to manage access from the resource provider's application. If the third-party application does not provide a mechanism for canceling access, you would be stuck with them having access to your information. With OAuth, there is a provision for revoking access at any time.

Will it become a de facto (standard?) in near future?

Well, although OAuth is a significant step forward, it doesn't solve problems if people don't use it correctly. For instance, if a resource provider gives only a single read-write access level to all your resources at once and doesn't provide a mechanism for managing access, then there is no point to it. In other words, OAuth is a framework to provide authorization functionality and not just authentication.

In practice, it fits the social network model very well. It is especially popular for those social networks that want to allow third-party "plugins". This is an area where access to the resources is inherently necessary and is also inherently unreliable (i.e. you have little or no quality control over those applications).

I haven't seen so many other uses out in the wild. I mean, I don't know of an online financial advisory firm that will access your bank records automatically, although it could technically be used that way.


You made it easy to understand. I may have changed the first line to something like this instead. "OAuth allows notifying a resource provider (e.g. Gmail) that the resource owner (e.g. you a gmail user) grants permission to a third-party (e.g. your LinkedIn account) access to their information (e.g. your contact list)." That which you wrote ie Provider and third party 'both' being Facebook is confusing. Though it kinda introduces an interesting scenario, that is Oauth can also be used internally—between different projects of your company. Right? Is that why you introduced a complicated intro?
As per my understanding, the purpose of OAuth is to grant time-limited authorization to a third-party application on behalf of resource owner without sharing credentials. I am curious to know whether I need OAuth to consume APIs hosted on my application server from mobile application (no third-party involved)?
When a trusted party authorizes me, doesn't that imply that it is also a authentication mechanism?
T
Troll

What is OAuth?

OAuth is simply a secure authorization protocol that deals with the authorization of third-party applications to access the user data without exposing their password. (e.g. login with Facebook, gPlus, Twitter in many websites) all work under this protocol.

Parties involved

The Protocol becomes easier when you know the involved parties. Basically, there are three parties involved: OAuth Provider, OAuth Client, and Owner.

OAuth Client (Application Which wants to access your credential)

OAuth Provider (eg. Facebook, Twitter, etc.)

Owner (the person with Facebook, Twitter, etc. account )

How It Works

I have supposed a scenario where a website (Stack Overflow) needs to add a login with the Facebook feature. Thus Facebook is OAuth Provider and the Stack Overflow is OAuth Client.

This step is done by the app's developer. At the very beginning, Facebook (OAuth Provider) has no idea about the Stack Overflow (OAuth Client) because there is no link between them. So the very first step is to register Stack Overflow with Facebook developers site. This is done manually where developers need to give the app's information to Facebook like the app's name, website, logo, redirectUrl (important one). Then Stack Overflow is successfully registered, has got client Id, client secret, etc from Facebook, and is up and running with OAuth.

https://i.stack.imgur.com/Vb3bY.png

Now when Stack Overflow's user clicks login with Facebook button. Stack Overflow requests Facebook with ClientId (Facebook uses it to recognize the client) and redirectUrl (Facebook will return back to this URL after success). Thus the user gets redirected to the Facebook login page. This is the best part user(owner) is not giving their Facebook credential to Stack Overflow.

https://i.stack.imgur.com/5Jev9.png

https://i.stack.imgur.com/8IVIJ.png

After Owner allows Stack Overflow to access the information. Then Facebook redirects back to Stack Overflow, along with authcode using the redirectUrl provided at step 2. Then Stack Overflow contacts Facebook along with the obtained authcode to make sure everything is okay. Only then Facebook will give access token to Stack Overflow. Then access token is used by Stack Overflow to retrieve the owner's information without using a password. This is the whole motive of OAuth, where actual credentials are never exposed to third-party applications.

For More:

Quick video

Web Link


sure localhost is also a url and why don't you expirement and post the result here.
yeah You can use the IP Address as the redirect URL: redirect_uri='127.0.0.1:4200' and the OAuth Domain name should be 127.0.0.1
But should the email be the same on both oAuth client and oAuth provider for it to work?
nice explanation
OAuth 2 is a Security protocol, not an Authorization protocol. The answer starts at the wrong note.
a
ameer

Simply put OAuth is a way for applications to gain credentials to your information without directly getting your user login information to some website. For example if you write an application on your own website and want it to use data from a user's facebook account, you can use OAuth to get a token via a callback url and then use that token to make calls to the facebook API to get their use data until the token expires. Websites rely on it because it allows programmers to access their data without the user having to directly disclose their information and spread their credentials around online but still provide a level of protection to the data. Will it become the de facto method of authorization? Perhaps, it's been gaining a lot of support recently from Twitter, Facebook, and the likes where other programmers want to build applications around user data.


OAuth is not, an authentication process, but rather an authorization process.
I'm not implying that the application needs authentication directly, but the user authenticates with the service provider to authorize some third party to access user data I think...
I added the precision because OpenID is specifically aimed at delegated authentication (re-use an existing external account) in the hope that people stop sharing their share credentials. OAuth is specifically aimed at authorization (re-using resources) in the hope to facilitate information exchange.
P
Premraj

OAuth(Open Authorization) is an open standard for access granting/deligation protocol. It used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords. It does not deal with authentication.

Or

OAuth 2.0 is a protocol that allows a user to grant limited access to their resources on one site, to another site, without having to expose their credentials.

Analogy 1: Many luxury cars today come with a valet key. It is a special key you give the parking attendant and unlike your regular key, will not allow the car to drive more than a mile or two. Some valet keys will not open the trunk, while others will block access to your onboard cell phone address book. Regardless of what restrictions the valet key imposes, the idea is very clever. You give someone limited access to your car with a special key, while using your regular key to unlock everything. src from auth0

Analogy 2: Assume, we want to fill an application form for a bank account. Here Oauth works as, instead of filling the form by applicant, bank can fill the form using Adhaar or passport. Here the following three entities are involved: Applicant i.e. Owner Bank Account is OAuth Client, they need information Adhaar/Passport ID is OAuth Provider

Applicant i.e. Owner

Bank Account is OAuth Client, they need information

Adhaar/Passport ID is OAuth Provider


r
randomness

Oauth is definitely gaining momentum and becoming popular among enterprise APIs as well. In the app and data driven world, Enterprises are exposing APIs more and more to the outer world in line with Google, Facebook, twitter. With this development a 3 way triangle of authentication gets formed

1) API provider- Any enterprise which exposes their assets by API, say Amazon,Target etc 2) Developer - The one who build mobile/other apps over this APIs 3) The end user- The end user of the service provided by the - say registered/guest users of Amazon

Now this develops a situation related to security - (I am listing few of these complexities) 1) You as an end user wants to allow the developer to access APIs on behalf of you. 2) The API provider has to authenticate the developer and the end user 3) The end user should be able to grant and revoke the permissions for the consent they have given 4) The developer can have varying level of trust with the API provider, in which the level of permissions given to her is different

The Oauth is an authorization framework which tries to solve the above mentioned problem in a standard way. With the prominence of APIs and Apps this problem will become more and more relevant and any standard which tries to solve it - be it ouath or any other - will be something to care about as an API provider/developer and even end user!


O
Ozkan

OAuth is all about delegating Authorization (choosing someone who can do Authorization for you). Note that Authentication and Authorization are different things. OAuth is Authorization (Access control), and if you want to implement Authentication (ID verification) also, OpenID protocol can be used on top of OAuth.

All big companies like Facebook, Google, Github,... use this kind of authentication/authorization nowadays. For example, I just signed in on this website using my Google account, this means Stackoverflow doesn't know my password, it receives the allowance from Google where my password (hashed obviously) is saved. This gives a lot of benefits, one of them is; In the near future you won't have to make several accounts on every website. One website (which you trust most) can be used to login to all other websites. So you'll only have to remember one password.


J
John Joe

OAuth happened when we sign up SO account with Facebook/ Google button.

Application (SO) redirecting user to the provider's authorization URL. ( Displaying a web page asking the user if he or she wishes to grant the application access to read and update their data). User agree to grant the application process. Service provider redirects user back to application (SO), passing authorization code as parameter. SO exchanges the code for an access grant.

Source : OAuth1 service providers


Hello, i need work with REST API so install oAuth, actually i am using Magento, In localhost, i have installed oAuth, in live server how can i instal, i am using GoDaddy VPS server, any help? @john joe
@Rathinam hi, II would like to help, but it is out of my expertise. So sorry.
Is possible shall i use REST API without oAuth? @John Joe
@Rathinam yes, it depends on you
Y
Yuvraj Singh Shekhawat

OAuth is an open standard for authorization, commonly used as a way for Internet users to log into third party websites using their Microsoft, Google, Facebook or Twitter accounts without exposing their password.


I think you've mistaken OAuth and OpenID
Р
Радослав Тодоров

OAuth is a protocol that is used from Resource Owner(facebook, google, tweeter, microsoft live and so on) to provide a needed information, or to provide a permission for write success to third party system(your site for example). Most likely without OAuth protocol the credentials should be available for the third part systems which will be inappropriate way of communication between those systems.


R
Rafiq

Authorization: OAuth as it name suggests is simply a standard for Authorization.

Used for log into third party websites: With OAuth, you can log into third party websites with your Google, Facebook, Twitter or Microsoft accounts without having the necessity to provide your passwords.

Remembering passwords: Using OAuth you can avoid creating accounts and remembering passwords on each and every web application that you use on the Internet.

Access token: OAuth is based on an access token concept. When a person authenticate hinself using his Google account, to a third party web application. Google authorization server issues an access token for that web application the person is using. Thus, the web application can use that access token to access his data hosted in the resource server. In the case of Google, your Gmail inbox, contacts, photos etc. are the resources. So, any third party application can access those resources, for an example view his Gmail inbox using OAuth. Hence, OAuth is a simple way to publish and interact with protected resource data. It’s also a safer and more secure way for people to give you access to their resource data.

OAuth2 and HTTPS: OAuth2 uses HTTPS for communication between the client and the authorization server because of confidential data for example client credentials. passing between the two applications.