Server integration guide
This guide describes the authentication flow, server SDK integration, and integration testing requirements. Refer to each server SDK and Demo repository README for installation, usage, configuration, and execution instructions. HTTP request and response specifications are defined in the HTTPS callback documentation.
1. Architecture and authentication flow
| Component | Responsibilities |
|---|---|
| Application server | Identify authenticated users, retrieve profiles, expose callbacks, and process business data |
| Server SDK (optional) | Generate and validate Code and SSToken; compute ASC configuration signatures; see each repository README for request signing, callback verification, and version requirements |
| Demo | Demonstrate an HTTP service built with the server SDK for local testing and implementation reference |
The server SDK is optional. You may use a server SDK or implement authentication yourself. Both approaches must follow the same callback protocol. Throughout this guide, SDK refers to the server SDK used by your application server; the client SDK is used to integrate games into the client application.
Basic integration flow:
- The application client requests a Code from your application server. The server obtains the UID from the authenticated session and generates a Code using a server SDK or your own authentication implementation.
- The application client passes the Code when loading the game.
- The SUD server calls your
get_sstokencallback with the Code. - Your application server validates the Code before obtaining the UID, generates an SSToken, and retrieves the user profile. It returns
ss_token,expire_date, anduser_info. - When the SUD server calls your
update_sstokencallback, your application server validates the supplied SSToken and returns a new token and its expiration time.
get_user_info is deprecated. New integrations return user information in get_sstoken.user_info.
2. Application configuration
Contact SUD to obtain appId, appKey, and appSecret. Provide platform information such as the iOS bundle ID and Android application ID, and confirm the test and production configurations. Manage credentials through server-side configuration rather than embedding them in source code.
3. Server SDKs and sample projects
Server SDK READMEs describe environment requirements, installation, methods, and versions. Demo READMEs describe configuration, startup, and verification.
| Language | Server SDK and usage | Demo and execution |
|---|---|---|
| Java | sud-gip-auth-java | hello-sud-java |
| Go | sud-gip-auth-golang | hello-sud-golang |
| Node.js | sud-gip-auth-nodejs | hello-sud-nodejs |
| PHP | sud-gip-auth-php | hello-sud-php |
| C# / .NET | sud-gip-auth-dotnet | hello-sud-dotnet |
When using a server SDK, run the Demo to understand token exchange. To integrate with an existing service, install the server SDK for your chosen language and refer to the Demo for routing, response serialization, and error mapping. If you implement authentication yourself, see Custom authentication. Use your application's user identities and profiles in production.
Local verification must cover Code generation, exchanging a Code for an SSToken and user information, and refreshing the SSToken. Local testing does not replace integration testing with SUD.
4. Application server implementation
- Obtain the UID for Code issuance from an authenticated session. Do not trust an arbitrary UID supplied by the client.
- When using a Demo as an implementation reference, replace mock profiles with profile retrieval based on a validated UID.
- Implement get_sstoken and update_sstoken using the specified field types and response formats.
- Follow the callback signature specification. Verify the original request body before parsing or reserializing it.
- Map authentication results to callback responses. Return
sdk_error_code=1005for expired tokens. Checkret_codeas well;sdk_error_codealone does not indicate success.
Server SDK return objects may use different names from the HTTP protocol. Serialize HTTP response fields as specified in the documentation, using snake_case; expire_date is a timestamp in milliseconds.
5. Callback configuration and integration testing
Deploy a publicly accessible HTTPS service. Contact SUD to configure the test and production URLs for get_sstoken and update_sstoken separately. Use the routes actually deployed by your service; interface names in this documentation do not require identical Demo route paths.
Verify the following with your application client:
- An authenticated user can obtain a Code and load the game with the correct profile.
- SSToken refresh returns a new token and expiration time in the required format.
- Expired or invalid tokens receive the appropriate error responses.
- When signature verification is enabled, valid requests pass and invalid signatures or modified bodies are rejected.
For troubleshooting, refer to the selected Demo README and the error codes.
6. Optional business callbacks
After basic authentication is integrated, add game start and settlement reporting, account and score callbacks, and asynchronous notifications as needed. See the HTTPS callback index. These protocols extend beyond the Demo's scope; Demos are not required to implement every callback.
get_account and update_score are optional callbacks used only by some games. Implement them according to the requirements of the games you integrate.
7. Custom authentication
If you do not use a server SDK, you must implement token generation, validation, and refresh yourself. Code and SSToken must be bound to a user identity. Use the corresponding UID only after successful validation. Your application defines its own Code issuance endpoint; the two callbacks exposed to SUD must follow the HTTP specifications in this documentation.
Return an SSToken, its expiration timestamp in milliseconds, and user information from get_sstoken. Return a new token and expiration time from update_sstoken. For expired tokens, return a nonzero ret_code and sdk_error_code=1005. Callback signature verification and token validation are separate operations.