OAuth
2 is an authorization framework that enables applications to obtain
limited access to user accounts on an HTTP service, such as Facebook,
GitHub, and DigitalOcean. It works by delegating user authentication to
the service that hosts the user account, and authorizing third-party
applications to access the user account. OAuth 2 provides authorization
flows for web and desktop applications, and mobile devices.
- Resource Owner : User - The resource owner is the user who authorizes an application to access their account. The application's access to the user's account is limited to the "scope" of the authorization granted (e.g. read or write access).
- Client : Application - The authorization server verifies the identity of the user then issues access tokens to the application.
- Resource Server - The server that keeping the resource owner’s protected resources. And this server is capable of accepting and responding to protected resource requests using access tokens.
- Authorization Server : API - The client is the application that wants to access the user's account. Before it may do so, it must be authorized by the user, and the authorization must be validated by the API.
Abstract Protocol Flow
- The application requests authorization to access service resources from the user
- If the user authorized the request, the application receives an authorization grant
- The application requests an access token from the authorization server (API) by presenting authentication of its own identity, and the authorization grant
- If the application identity is authenticated and the authorization grant is valid, the authorization server (API) issues an access token to the application. Authorization is complete.
- The application requests the resource from the resource server (API) and presents the access token for authentication
- If the access token is valid, the resource server (API) serves the resource to the application.
Application Registration
- Application Name
- Application Website
- Redirected URI or Callback URI
Client ID and Client Secret
Once your application is registered, the service will issue "client credentials" in the form of a client identification number and a client secret.
The Client ID is a publicly exposed string that is used by the service API to identify the application, and is also used to build authorization URLs that are presented to users.
The Client Secret is used to authenticate the identity of the application to the service API when the application requests to access a user's account, and must be kept private between the application and the API.
Authorization Grant
- Authorization Code: used with server-side Applications
- Implicit: used with Mobile Apps or Web Applications (applications that run on the user's device)
- Resource Owner Password Credentials: used with trusted Applications, such as those owned by the service itself
- Client Credentials: used with Applications API access.
0 Comments: