# Get Key ## Description >To obtain a new key for launching the game, provide currency for the initial login. If no account exists, a new account will be created automatically. > Request method:( Host-> BeSoft):post > Encoding method:application/x-www-form-urlencoded > Besoft The response data format is: application/json ## Method URL >{besoftapi}/api/game/getKey ## Request Parameters | Name | Type | Required | Description | | -------- | -------- | -------- | -------- | | cert | string | Y | security code | | user |string (30) | Y | unique user id (only allow lower case a-z and 0-9) BY WEBSITE)| | userName |String(50) | Y | 1. A display name in BESOFT Fish Games. , 2. Only Support 16 Unicode characters| | extension1 | string(20) | Y | agent Id from ARS,belong to website | ## Example - URL: - http://127.0.0.1:8000/api/game/getKey - HTTP Method - POST - Form Data > Content-Type: application/x-www-form-urlencoded ``` cert:v8VMKKzlPpD0te4rX99Hgefs3PQrBFWJKiuUqg6Y user:test1 extension1:adminweb ``` ## Return Result | Name | Type | Description | | -------- | -------- | -------- | | status | string | status code | |key |string | access token (default valid time: 10 minutes)| |returnurl |string | Return the URL for logging into the game. When logging into a specific game, include the 'kindid' for the specified game.| ## Successful Result ``` { "status": 1,     "key": "o7301PFJ6FkBQSTJpilxNgOnSVZfMb2rtdZGZAUCPxIAIJdfPCJKVbWBnjNeN256QjE8K19lO7S2SYWMPVQWy8",     "returnurl": "https://127.0.0.1:8000/?key=o7301PFJ6FkBQSTJpilxNgOnSVZfMb2rtdZGZAUCPxIAIJdfPCJKVbWBnjNeN256QjE8K19lO7S2SYWMPVQWy8" } ``` ## Failed Result > {“staus”:1001} ## Login ### Descripti on >Invoke this method with your “Key” (returned by GetKey API) to launch game. >Game return description: After the game is closed, the return address (return_url= the parameter of the return address), if not filled in, the game has no return button. ## Method URL ``` http://{BesoftFront}/?key=3F6AE577A2E2255EF4BACF02C9F8BB1154A9C6AD2F19701 568BA675BDA3C46BCA64D243007F87C86119329271708&gid=be001&lang=en&return_url=https://returnyoururl.com ``` > New interface: If you need to close the current window directly, please use the window.open mode to open, and do not need to pass the return_url > New interface: If the parameter return_url is added, please encode the parameter in URLEncoding mode > Embedded interface: If it is embedded, please listen for this message notification (closeMessage), the game manufacturer closes the game's call interface ``` {    window.parent.postMessage("closeMessage", "*") } ``` ## Request Parameter | Name | Type | Required | Description | | -------- | -------- | -------- | -------- | | acc | String(30) | Y | User ID | | key |string(86) | Y |1.Key value returned by “GetKey” , 2.Please do URLEncoding on it while using the HTTP GET method) | | aid | string(20) | Y | Agent Id | | nick | string (50) | Y | User name Only Support 16 Unicode characters | | gid| Integer | Y| input gameId as default launch game ; if blank, go to lobby. | | lang| string | Y| default is cn , cn : simplified Chinese , en : english | | return_url | string | N | return_url=Game off return address,Please encode the parameters in URLEncoding mode | ## Return Result ### Successful Result >Redirect Browser to game hall page ### Failed Result >The game interface displays the corresponding error message.