HG calls the Headline backend API to register and bind users.
When an HG user clicks to open Headline, they need to request a one-time token from the Headline API for this specific user. This one-time token can be used to verify the user's identity and authorize their access to the related content on Headline.
After obtaining the user's one-time token, HG can use an iframe element to embed the Headline website in its own page. The user’s one-time token is appended to the embedded URL, so that when the user accesses this iframe, the login process will be automated and they do not need to manually enter their username and password.
Interaction flowchart
Register and bind account
When registering users in the HG business system, it is necessary to call the HL trading system interface for user registration and binding.
Use the ManagerApi to create users and bind operations. The interface address is as follows:.
When opening the Headline trading page in HG, you need to obtain a valid token through the Headline backend interface.
A one-time valid token is requested based on the user customer number and corresponding password that have been bound. The interface address is as follows:
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,
"{\"type\":2,\"device\":1,\"loginName\":\"13429837442\",\"isThird\":false,\"thirdSource\":\"\",\"bindThirdUserId\":\"\",\"loginPwd\":\"dc483e80a7a0bd9ef71d8cf973673924\"}");
Request request = new Request.Builder()
.url("https://example.com/login/customer.app.CustomerWebApiService.login")
.post(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
The Headline trading UI needs modification to add the logic for exchanging valid tokens for real access tokens.
The Headline trading UI proactively calls the interface to obtain a real access token based on the tsource parameter in the URL. The interface address is as follows: