v1 (DR)

This section provides detailed EMP API specifications.

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.

Basic information

EMPBaseURL

The LG representative will provide information to the individual based on their needs.

 

API List

End Point Summary HTTP Method
{{EMPBaseURL}}/authorize

Requests the login process from the EMP.

(→ The EMP proceeds with the login and issues an authorization code.)
 

GET

{{EMPBaseURL}}/token 

grant_type = authorization_code

Requests an access token renewal from the EMP.

(→ The EMP issues access_token and refresh_token.)

POST

{{EMPBaseURL}}/token 

grant_type = refresh_token

Requests the EMP to renew an access token.

(→ EMP re-issues access_token.)

POST

DR Service Use Only

End Point Summary HTTP Method Remark

{{EMPBaseURL}}/profile

Requests the user profile from the EMP. 

GET 

Can only be used by a DR service and NOT available for ThinQ Connect service.

Request Authorization (Login)

During this process, the service requests a login page from the EMP so the user can log in with an LG account (or 3rd party account linked with an LG account). When the user logs in, an authentication code is sent from the EMP.

End Point 

{{EMPBaseURL}}/authorize

Method

GET

Request

Query Parameter

Name Description Required

client_id

Service (Application) identifier

  • A value issued by the EMP (authorization server) in order to identify the service.
  • You can request that your LG representative issue this value for you.
Mandatory

redirect_uri

A URI that the EMP uses to redirect the user's web browser to the service after performing a request

  • If this API is called, the EMP redirects the user to a login page, completes the login process, and returns the user (user agent) back to the service. This value refers to the address where the user will be returned.
  • You must perform UTF-8 encoding for the value.
Mandatory

response_type

Enter this as code.

  • This denotes use of the Authorization Code Grant Type over the grant methods of the OAuth 2.0 protocol.
Mandatory

state

A value for defending against cross-site request forgery. Include this value when the EMP redirects the user's web browser back to the service after performing a request.

Mandatory

Request Example

{{EMPBaseUrl}}/authorize?response_type=code&client_id={{xxxxxxx}}&redirect_uri={{xxxxxxx}}&state={{xxxxxxx}}

Result

If successful, the EMP redirects the user's web browser (user agent) to the login page. If the user logs in successfully, the EMP redirects the web browser to the service again. For the redirect address, the EMP uses the redirect_uri value that was sent as a parameter.

In addition, the EMP issues an authorization code to the service by including the code in the query string of redirect_uri when redirecting the web browser.
 

 

Error Code

Error Code Error Message Remark
400

app_id is incorrect

The client_id is invalid.

An alert pop-up upon login

Mismathing Redirect URI Error 

Login requested with an unregistered redirect_uri

An alert pop-up upon login

This service is not currently supported in your country.

The user didn't agree to the terms of a third party agreement

Request Access Token 

Requests the EMP to issue a token. Upon success, the EMP provides an access token and a refresh token.

End Point 

{{EMPBaseURL}}/token

Method

POST

Request

Query Parameter

Name Type Description Required

client_id

String

Service (Application) identifier

Mandatory

redirect_uri

String

The same value as redirect_uri used when calling GET {{EMPBaseURL}}/authorize

Mandatory

code

String

An authorization code received from the EMP

  • It is included in the redirect_uri as a query string after calling GET {{EMPBaseURL}}/authorize
Mandatory

grant_type

String

Enter this as authorization_code.

Through this API's request,

  • When requesting an access token: enter it as authorization_code.
  • When renewing an access token (reissuing an access token as a refresh token): enter it as refresh_token.
Mandatory

Request Example

{{EMPBaseURL}}/token?grant_type=authorization_code&code={{xxxxxx}}&client_id={{xxxxxx}}&redirect_uri={{xxxxxx}}

Result

If successful, the service receives an access token, the token expiration time, and a refresh token (required when renewing an access token) from the EMP.

Response Body

Name Description Example

access_token

An OAuth 2.0 access token issued by the EMP

xxxxxxxxxxxxxxxxxxxx

expires_in

Time remaining until an access token expires (unit: sec)

3600

refresh_token

A token used to request a new access token from the EMP

  • The value is sent only when grant_type is not entered as refresh_token when making the API's request
xxxxxxxxxxxxxxxxxxxx

oauth2_backend_url

EMP backend url

  • The value is sent only when grant_type is not entered as refresh_token when making the API's request
https://example.lge.com/

Response Example

{
  "access_token" : "xxxxxxxxxxxxxxxxxxxx" ,
  "expires_in" : "3600" ,
  "refresh_token" : "xxxxxxxxxxxxxxxxxxxx" ,
  "oauth2_backend_url" : "https://example.lge.com/"
}

Error Code

Error Code Error Message Remark

400

App_id Fail

Invalid client_id

LG.OAUTH.EC.4001

OAuth2 processing error

Invalid parameter 

Refresh Access Token

Requests the EMP to renew an access token. Upon request, the service sends a refresh token and receives a new access token in response.

End Point

{{EMPBaseURL}}/token

Method

POST

Request

Query Parameter

Name Description Required

client_id

Service (Application) identifier

Mandatory

refresh_token

A refresh_token value included in the response of an access token issuance request at the time of login

Mandatory

grant_type

Enter this as refresh_token.

Through this API's request,

  • When requesting an access token: enter it as authorization_code.
  • When renewing an access token (reissuing an access token as a refresh token): enter it as refresh_token.
Mandatory

Request Example

{{EMPBaseURL}}/token?client_id={{xxxxxxx}}&refresh_token={{xxxxxxx}}&grant_type=refresh_token

Result

If successful, the service receives a new access token and a token expiration time from the EMP in response.

Response Body

Name Type Description Example

access_token

String

An OAuth 2.0 access token issued by the EMP

xxxxxxxxxxxxxxxxxxxx

expires_in

String Time remaining until an access token expires (unit: sec)
3600

Response Example

{
  "access_token" : "xxxxxxxxxxxxxxxxxxxx" ,
  "expires_in" : "3600" ,
}

Error Code

Error Code Error Message Remark
400 App_id Fail Invalid client_id
LG.OAUTH.EC.4001 OAuth2 processing error

Invalid parameter