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)
|
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 |
grant_type = authorization_code |
Request to issue an access token. (→ The EMP issues access_token and refresh_token.) |
POST |
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
|
Mandatory |
redirect_uri |
String |
A URI that the EMP uses to redirect the user's web browser to the service after performing a request
|
Mandatory |
response_type |
String |
Enter this as
|
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 |
Mandatory |
code |
String |
An authorization code received from the EMP
|
Mandatory |
grant_type |
String |
Enter this as Through this API's request,
|
Mandatory |
backend_url |
String |
Backend_url value sent after the EMP login |
Optional |
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
|
xxxxxxxxxxxxxxxxxxxx |
oauth2_backend_url |
EMP backend url
|
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
|
412 |
required backend_url |
Parameter missing
|
412 |
required grant_type |
Parameter missing
|
412 |
required code |
Parameter missing
|
412 |
required redirect_uri |
Parameter missing
|
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 |
grant_type |
String |
Enter this as Through this API's request,
|
Mandatory |
backend_url |
String |
Backend_url value sent after the EMP login |
Optional |
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
|
412 |
required backend_url |
Parameter missing
|
412 |
required grant_type |
Parameter missing
|
412 |
required refresh_token |
Parameter missing
|
401 | not allowed client_id | Not allowed client_id |
500 | oauth date time error |
OAuth communication error |