API Call Sequence
This section explains the EMP API call flow for using the web login provided by the EMP.
The EMP API has been designed based on the OAuth 2.0 - Authorization Code Grant Type protocol. (Note that variable names, required options, etc. may be slightly different from the standard.)
Please refer to the following term definitions.
- Authorization Server (OAuth 2.0): Corresponds to the EMP proxy server. Hereafter expressed as the EMP.
- Client Application (OAuth 2.0): Corresponds to your service. Hereafter expressed as the service.
① Request Authorization (Login)
API to be Used
GET {{EMPBaseUrl}}/authorize
Sequence
- The service calls
GET {{EMPBaseUrl}}/authorize
to request the EMP to provide a login process using an LG account (or 3rd party account linked with an LG account). At this point, your service must pass on the following values:- client_id:: A value for the EMP to identify the service. Enter the EMP app key issued by LG.
- redirect_uri: The address where the EMP will return the user (user agent) to the service after completing the login process
- response_type: Enter
code
. - sate: A value for defending against cross-site request forgery
- The EMP moves the user's web browser (user agent) to the login page and proceeds with the login.
- When the login is successful, the EMP sends the authorization code to the service. At this time, the EMP redirects the user's web browser to the redirect_uri provided by the service, and the authorization code is included as a query string in the redirect_uri and delivered to the service.
② Request Access Token
API to be Used
POST {{EMPBaseUrl}}/token (grant_type=authorization_code)
Sequence
- The service calls
POST {{EMPBaseUrl}}/token
to request the EMP to issue an access token. At this point, your service must pass on the following values:- client_id: A value for the EMP to identify the service. Enter the EMP app key issued by LG.
- code: An authorization code issued by the EMP. This is included in the redirect_uri returned from the EMP after the authorization request.
- redirect_uri: Enter the same value as in the authorization request.
- grant_type: Enter
authorization_code
. - backend_url: backend_url received after the EMP login.
- The EMP authorizes the service, verifies the authorization code, and checks Redirect_URI.
- If everything is okay, the EMP issues an access token (
access_token
) to the service as a result of the API call.