Jump to: navigation, search

Unified Login Verification

Unified Login Verification

Unified login verification flowchart
Oauth-login.jpg
1.Game client calls AnySDK framework login API, client pops up channel SDK login interface and corresponding channel SDK will internally send login request to channel platform server.
2.User login succeeds, channel SDK acquires the user ID and verification code returned by the channel platform server
3.AnySDK framework acquires user ID and verification from SDK and sends user login info. Verification request to the game server (the address of the requested API is the user login verification address that developers put on the packing toll channel parameter)
Note: the three steps above would be accomplished by AnySDK Framework without extra code from developers)
4.After receiving the parameter of the request from client, the game server would pass the user's information and other parameters to AnySDK server(PHP and Java demo code of operation of this step is provided below for reference or direct usage
(Note:Here the number and content of parameters that each SDK receives differ, so that the game server would need to pass all parameters requested to be verified to login.)
5.AnySDK server receives the request data from game server and conducts user login verification to corresponding channel platform servers.
6.AnySDK server receives the verification result of channel server and acquires the user's final AccessToken
7.AnySDK framework passes the returned verification result from channel server to the game client.
8.The game server returns verification result to AnySDK framework as well as some game logic related data to game client
9.AnySDK framework executes the login callback function to notify the game client if login succeeds.

Game Server Requests Login Verification

Encoding Instruction

When encoding coding characters of the server, you need to use utf-8 without bom to avoid possible data encoding errors that might result in failure of data analysis by the server; you can use notepad++ to conduct conversion.

Login Verification Url

http://oauth.anysdk.com/api/User/LoginOauth/ (Note: use post method with http protocol)


Login Verification Demo of the Server

1.php demo
 OauthLoginDemo-php.zip
2.java demo
 OauthLoginDemo-java.zip
3.nodejs demo
 OauthLoginDemo-nodejs.zip

AnySDK Login Verification And Responding to Data

The data acquired by AnySDK login verification would all return in json format, including four subdomains: status、data、common and ext.
1.status:used to express if the request succeeded
2. data: saves the verification info. returned by the channel platform (the data format here might differ according to different implementation of different channels; some channels might return more user data then others, which only return the verification result; AnySDK returns these so that game server can acquire all the original verification; developers can choose to utilize them or ignore them, neither would influence their integration process in any way)
3common: including channel ID, SDK ID, user ID returned by channel (channel only), and the game server ID chosen by user before login (defaulted to be null unless the client has called a overriding login function with serverId). Developers should use this section as user data.
4. ext: null by default; game server can save game logic related data (such as user ID set internally by developer server) in ext domain, and these data will be acquired by game server when it receives the msg info. comes with the login callback and used to execute corresponding game logic.

Successful returning cases (take 360 as an example)

  {
      "status":"ok",
      "data":
      {
            "id":"18135798",
            "name":"\u6b27\u9ea6\u560e\u5730",
            "avatar":"http:\/\/u1.qhimg.com\/qhimg\/quc\/48_48\/22\/02\/55\/220255dq9816.3eceac.jpg?f=6c449fbaaa093e52b4053e46170af079",
            "sex":"\u672a\u77e5",
            "area":"",
            "nick":"",
              "access_token":"49395625948d4d6f253203e8aa8f3316150290e9d57be59b2",	   
              "refresh_token":"493956259454b771dba785feeafb01221858440f4c811b5ad"
      },
      "common":
       {
             "channel":"000023",
             "user_sdk":"360",
             "uid":"18135798"
             "server_id":""
       },
     "ext":""
  }

Failed returning cases:

  {
     "status":"fail",
    "data":
     {
         "error":"login_check_fail",
        "error_no":"20002"
      } 
  }

Error Code