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 |
grant_type = authorization_code |
Requests an access token renewal from the EMP. (→ The EMP issues access_token and refresh_token.) |
POST |
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 |
---|---|---|---|
|
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
|
Mandatory |
redirect_uri |
A URI that the EMP uses to redirect the user's web browser to the service after performing a request
|
Mandatory |
response_type |
Enter this as
|
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 |
Mandatory |
code |
String |
An authorization code received from the EMP
|
Mandatory |
grant_type |
String |
Enter this as Through this API's request,
|
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
|
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 |
---|---|---|
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 Through this API's request,
|
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 |