OAuth

Before understanding Oauth first we need to understand, what is Authentication and Authorization?

Authentication: is the process of verifying who you are. When you log on to a PC with a user name and password you are authenticating.

Authorization: is the process of verifying that you have access to something. Gaining access to a resource (e.g. directory on a hard disk) because the permissions configured on it allow you access is authorization.

Now let's understand what is Oauth,

Have you seen google icon or facebook icon on linked in site? Answer is yes!
What is that why these icons are there, they are there so that you can tell your friends about linkedin

Oauth makes this possible, oAuth is basically a way for you to share your resources from resource server to third party without revealing your user name and password on the resource server to the thirs party.

You have some  Contacts, and you trusted Gmail to host these resources for you and a third party like linkedin need access to those resources



1. you are the resource owener
2. The party that host the resources is resource server
3. And third party i.e client(linkedin)

It is basically a set of rule that was agreed by industries giant that this should happen





























Step 1 − First, the user accesses resources using the client application such as Google, Facebook, Twitter, etc.
Step 2 − Next, the client application will be provided with the client id and client password during registering the redirect URI (Uniform Resource Identifier).
Step 3 − The user logs in using the authenticating application. The client ID and client password is unique to the client application on the authorization server.
Step 4 − The authenticating server redirects the user to a redirect Uniform Resource Identifier (URI) using authorization code.
Step 5 − The user accesses the page located at redirect URI in the client application.
Step 6 − The client application will be provided with the authentication code, client id and client password, and send them to the authorization server.
Step 7 − The authenticating application returns an access token to the client application.
Step 8 − Once the client application gets an access token, the user starts accessing the resources of the resource owner using the client application.

Conclusion:
For example user installs uber app in his/her phone, And when the user opens the app it asks for login,signup/login via facebook, Gmail, Paytm. Since, user is already exists in facebook, Gmail, Paytm so the user chooses login via Paytm just to save his/her time. Do you know how this works?

Does facebook/Paytm/Gmail really give the user name or password to the Uber ? The answer is NO!
Here, the concept of oAuth comes into the picture. Paytm/Facebook/Gmail configure client id, client secret for Uber(as merchant) in their system and provides the same to Uber. Uber sends the given client Id,client secret, redirect URL in their request and once the valid request is validated by Facebook/Paytm/Gmail, they provide access token to Uber and now Uber will use this access token and will authorize it for different access. 

The above case was not possible before oAuth. oAuth makes this possible, oAuth is basically a way for you to share your resources from resource server to third party without revealing your user name and password on the resource server to the third party.

So, in our example Uber can use the customers of Paytm/Facebook/Gmail to use their system by authorizing it for different purpose.

















Comments