Skip to content

User Authentication ​

Document Overview ​

This document mainly describes the complete flow for an app to integrate SUD OP authentication, including the interaction steps of each participant, interface call descriptions, and core field definitions, helping developers quickly complete the integration and development of SUD OP authentication.

Participants ​

  • APP: the app client
  • SUD OP: the communication middleware integrated into the client
  • Game: the game client
  • Game SVR: the game server
  • SUD OP SVR: the SUD server (the core hub for credential circulation and verification)
  • APP SVR: the app server

Authentication Flow Details ​

Overall Flow Sequence ​

Step Breakdown ​

Step 1: The app generates the user signature on its own server ​

  • Call direction: APP → APP SVR
  • Interface name: generateUserSignature
  • Request parameters: APP's Login Token (the token of the app's own login state, used by the server to verify the user's identity)
  • Response parameters: userSignature (the user signature, used to subsequently initiate authentication with SUD OP)
  • Core notes: This step is completed by the integrator's own server, which generates the signature. The uniqueness and security of the signature must be guaranteed; the signature must be able to identify the user and be tamper-proof.

Step 2: The app initiates an authentication request to SUD OP ​

  • Call direction: APP → SUD OP
  • Interface name: auth
  • Request parameters: userSignature (the user signature generated in Step 1)
  • Core notes: The app carries the valid user signature and initiates an authentication request to the SUD OP client service.

Step 3: SUD OP verifies the user identity with the SUD server ​

  • Call direction: SUD OP → SUD SVR
  • Interface name: authAppUser
  • Request parameters: userSignature (the user signature passed in by the app)
  • Core notes: The SUD OP client passes the user signature through to the SUD server, which completes the validity verification of the signature.

Step 4: The SUD server generates the authentication credentials ​

After verifying that the userSignature is valid, the SUD SVR performs the following operations:

  1. Generates userToken based on userSignature (the user's identity credential in the SUD system);
  2. Generates AppUnionID based on userSignature (the user's unique identifier in the SUD system);
  3. Generates refreshToken (used to refresh the userToken) and expiresIn (the userToken expiration time, in seconds).

Step 5: The SUD server returns the authentication credentials to SUD OP ​

  • Call direction: SUD SVR → SUD OP
  • Response parameters: userToken, refreshToken, expiresIn

Step 6: SUD OP returns the authentication result to the app ​

  • Call direction: SUD OP → APP
  • Response result:
    • SUCCESS: authentication passed (credentials such as userToken have been obtained at the underlying level);
    • FAILED: authentication failed (invalid/expired signature, etc.).

Core Field Descriptions ​

FieldTypeDescription
APP's Login TokenStringThe user token of the app's own login system, used by the APP SVR to verify the user's identity
userSignatureStringThe user signature generated by the APP SVR; must be unique and tamper-proof
userTokenStringThe user identity credential in the SUD system, used to subsequently access SUD-related services
refreshTokenStringUsed to refresh an expired userToken
expiresInIntThe expiration time of the userToken (in seconds)
AppUnionIDStringThe user's unique identifier in the SUD system, which can be used to associate users across apps

Exception Handling ​

  1. If the APP SVR fails to verify the Login Token in Step 1, it needs to return an error to the app and terminate the authentication flow;
  2. If the SUD SVR verifies in Step 3 that the userSignature is invalid (e.g., the signature is expired or forged), SUD OP returns FAILED to the app;
  3. If a network exception causes a request in a step to time out, it is recommended that the app add a retry mechanism (note the number of retries to avoid frequent requests).

Integration Notes ​

  1. The generation rules for userSignature need to be customized by the app side. It is recommended to use "asymmetric encryption + timestamp + random string" to improve security;
  2. The userToken is a sensitive credential; the app needs to store it encrypted and avoid transmitting and storing it in plaintext;
  3. You need to monitor the expiration status of the userToken and refresh the token by calling the SUD interface via the refreshToken before it expires;
  4. It is recommended to use the HTTPS protocol for all interface calls to prevent data from being tampered with or stolen.