v2 (ThinQ Connect)

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

Server Phase

EMPBaseURL Remark
QA

https://qt-{CNTRY}.m.lgaccount.com/emp/v2

CNTRY : ISO country code (2 digits)

  • example
    • Korea: kr 
    • USA: us
    • China: cn
    • Russian Federation: ru
    • ......
OP https://{CNTRY}.m.lgaccount.com/emp/v2

 

API List

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

Request the login process.

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

GET

{{EMPBaseURL}}/token 

grant_type = authorization_code

Request to issue an access token.

(→ The EMP issues access_token and refresh_token.)

POST

{{EMPBaseURL}}/token 

grant_type = refresh_token

Request to reissue an access token with refresh_token.

(→ EMP reissues access_token.)

POST

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 Type Description Required

client_id

String

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

String

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

String

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

String

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={{xxxxxx}}&redirect_uri={{xxxxxx}}&state={{xxxxxx}}

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
500

Page not found

There is an error in the requested information.

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

backend_url

String

Backend_url value sent after the EMP login

Mandatory

Request Example

{{EMPBaseURL}}/token?grant_type=authorization_code&code={{xxxxxx}}&client_id={{xxxxxx}}&redirect_uri={{xxxxxx}}&backend_url={{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
412

required client_id

Parameter missing

  • client_id 
412

required backend_url

Parameter missing

  • Backend_url 

412

required grant_type

Parameter missing

  • Grant_type 

412

required code

Parameter missing

  • code 

412

required redirect_uri

Parameter missing

  • redirect_uri

401

not allowed client_id

Not allowed client_id

500

oauth date time error

OAuth communication error

Refresh Access Token

Requests the EMP to reissue 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 Type Description Required

client_id

String

Service (Application) identifier

Mandatory

refresh_token

String

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

Mandatory

code

String

an authorization code received from the EMP, which is included in the redirect URI as a query string after calling GET {{EMPBaseURL}}/authorize

Mandatory

grant_type

String

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

backend_url

String

Backend_url value sent after the EMP login

Mandatory

Request Example

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

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
412

required client_id

Parameter missing

  • client_id 
412

required backend_url

Parameter missing

  • Backend_url 

412

required grant_type

Parameter missing

  • Grant_type 

412

required refresh_token

Parameter missing

  • refresh_token 
401 not allowed client_id Not allowed client_id
500 oauth date time error

OAuth communication error