Added Steam_Login.md to explain how the login is handled.

This commit is contained in:
ZKWolf 2023-06-08 18:55:27 +02:00
parent c9ecfcb321
commit 966c475230

126
Doc/Steam_Login.md Normal file
View File

@ -0,0 +1,126 @@
# API Documentation - /api/v1/auth/provider/steam/login
This endpoint allows clients to authenticate users using their Steam signed session ticket. The client sends a POST request to this endpoint with a token, which is the Steam signed session ticket.
## Endpoint
`/api/v1/auth/provider/steam/login`
## Request
- Method: POST
- Headers:
- Content-Type: application/json
### Request Body
The request body should contain the following parameter:
- `token` (string): The Steam signed session ticket. The token always starts with `14000000` and is a long hexadecimal string.
## Forwarding the Request
The server forwards the request to the following address:
`https://api.steampowered.com/ISteamUserAuth/AuthenticateUserTicket/v1/`
This address requires the following three arguments:
- `key` (string): The Steam Web API key. You can obtain this key from [Steam Dev API Key](https://steamcommunity.com/dev/apikey). Please note that a private key can only be used 100.000 times per day.
- `ticket` (string): The Steam signed session ticket.
- `appid` (integer): The ID of the game. In this case, the ID is `555440`.
## Response
The server responds with a JSON object containing various information. The only required information for further processing is the `steamid` of the user.
### Response Body
The response body will contain the following data:
- `preferredLanguage` (string): The preferred language of the user, set to "en" (English).
- `friendsFirstSync` (object): Contains synchronization information for friends. The value for the `steam` key is set to `true`.
- `fixedMyFriendsUserPlatformId` (object): Contains information related to user platform identification. The value for the `steam` key is set to `true`.
- `id` (string): The user ID generated by the system.
- `provider` (object): Contains information about the authentication provider.
- `providerId` (string): The Steam ID of the user.
- `providerName` (string): The name of the provider, set to "steam".
- `userId` (string): The user ID.
- `providers` (array): Contains a list of providers associated with the user. In this case, it only includes the Steam provider.
- `providerName` (string): The name of the provider, set to "steam".
- `providerId` (string): The Steam ID of the user.
- `friends` (array): An empty array representing the user's friends.
- `triggerResults` (object): Contains success and error information related to triggers. Both arrays are initially empty.
- `success` (array): An empty array.
- `error` (array): An empty array.
- `tokenId` (string): The user ID generated by the system.
- `generated` (integer): The current time in Unix epoch format.
- `expire` (integer): The time when the session will expire in Unix epoch format. This value is calculated by adding 24 hours (86400 seconds) to the current time.
- `userId` (string): The user ID generated by the system.
- `token` (string): The authentication token generated for the user.
The response will be in the following format:
```json
{
"preferredLanguage": "en",
"friendsFirstSync": { "steam": true },
"fixedMyFriendsUserPlatformId": { "steam": true },
"id": "USERID",
"provider": {
"providerId": "STEAMID",
"providerName":
"steam",
"userId": "USERID"
},
"providers": [
{ "providerName": "steam", "providerId": "STEAMID" }
],
"friends": [],
"triggerResults": {
"success": [],
"error": []
},
"tokenId": "USERID",
"generated": "CURRENT_TIME",
"expire": "EXPIRE_TIME",
"userId": "USERID",
"token": "TOKEN"
}
```
Please note that the values `USERID`, `STEAMID`, `CURRENT_TIME`, `EXPIRE_TIME`, and `TOKEN` should be replaced with the actual values generated by the system.
## Example
Here is an example of how the response would look:
```json
{
"preferredLanguage": "en",
"friendsFirstSync": { "steam": true },
"fixedMyFriendsUserPlatformId": { "steam": true },
"id": "xx000x00-x000-00x0-x0xx-x0000000000x",
"provider": {
"providerId": "00000000000000000",
"providerName": "steam",
"userId": "xx000x00-x000-00x0-x0xx-x0000000000x"
},
"providers": [
{ "providerName": "steam", "providerId": "00000000000000000" }
],
"friends": [],
"triggerResults": {
"success": [],
"error": []
},
"tokenId": "0x0000x0-00x0-0xxx-00x0-x00x0x000x0x",
"generated": 1686327828,
"expire": 1686414228,
"userId": "xx000x00-x000-00x0-x0xx-x0000000000x",
"token": "0x0000x0-00x0-0xxx-00x0-x00x0x000x0x"
}
```
In this example, the `steamid` is `"00000000000000000"`, and the other values are placeholders that need to be replaced with actual data.