What is OAuth (Open Authorization) ?

OAuth (Open Authorization) is an open standard protocol for authorization of an application for using user information, in general, it allows a third party application access to user related info like name, DOB, email or other required data from an application like Facebook, Google etc. without giving the third party app the user password. It is pronounced as oh-auth.

You might have seen a “login with Google” or “login with Facebook” button on the login/signup page of a website that makes easier to get using the service or website by simply logging into one of the services and grant the client application permission to access your data without giving Password. This is done with the OAuth.

It is designed to work with HTTP(Hyper Text Transfer Protocol) and it allows access tokens to be issued to the third party application by an authorization server with the approval from the owner.

There are 3 Components in OAuth Mechanism

  1. OAuth Provider – This is the OAuth provider Eg. Google, FaceBook etc.
  2. OAuth Client – This is the website where we are sharing or authenticating the usage of our information. Eg. GeeksforGeeks etc.
  3. Owner – The user whose login authenticates sharing of information.

OAuth can be implemented via google console for “Login/Sign Up with Google” on a web app.
Pattern to be Followed

  1. Get OAuth 2.0 Client ID from Google API Console
  2. Next, Obtain an access token from the Google Authorization Server to access the API.
  3. Send the request with the access token to an API .
  4. Get Refresh token if longer access is required.
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.