According to Wikipedia, OAuth is an open standard for access delegation, commonly 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. OAuth is a standard application can use to provide the client application with “secure delegated access”. OAuth have two version, OAuth 1.0a and OAuth 2, the specification is completely different from one another and cannot be used together.
What Does OAuth Do ?
OAuth is basically for supports authorization workflows. OAuth is taken care by an Authentication service.
How OAuth Works ?
There are 4 separate modes of OAuth for building our service, they called grant types will be used on web servers.
1. The Authorization Code Grant Type
Authorization code OAuth can be used on web servers. If you want to use authorization code grant type if building for a web application, OAuth flow in server side web framework like Ruby on Rails, Django, and an Authorization is the way to go.
Here’s how it works :
- Anonymous user can visit your website.
- You can use third party Identity like Google, Facebook and your OAuth service that you created.
- Click login on your site.
- Accept these permissions, they will redirect the user back to your web application with an authorization code.
- The web server will make a request with the authorization code.
2. The Implicit Grant Type
Implicit grant type is meant to be used for the client side web application like React.js or Angular.js. Implicit grants are ideal for client web application and mobile apps.
How it works :
- Anonymous user can visit your website and opens your mobile app.
- Log into your site using the third party like Google, facebook, and your own OAuth service that you created.
- Click Log in and are prompted will accept certain permissions.
- If accept this permission the provider will redirect the user on your web.
- You can use these access token to actually retrieve user information. like this pic:pic
3. The Password Credential Grant Type
Password credential grant type is meant to used for the first class web application or mobile application. if you have built your own OAuth service (login.yoursite.com), and then created your own OAuth client application, you could use this grant type to authenticate users for your native Android, iPhone, and web apps.
How it works :
- Anonymous user visits your website or open your mobile app.
- login into your site/app using their identity
- Input their username and password.
- You can use this access. Like this pic:pic
4. The Client credential Grant Type
Client credentials grant type is meant to be used for application code. You are building an application that needs to perform the nonuser related task.
How it’s work:
- Your application makes a request to the identity provider’s API service using it’s application credentials.
- It receives an access token back, which can be used to make API requests.
When Use OAuth?
You can use OAuth if you need and you are can building service where you need to use.
That was an explanation of What is OAuth. If you want to learn other science about technology, problem-solving, engineering software you can visit our blog at www.41studio.com/blog because there will be lots of knowledge that we will share with you all.