Skip to content

Commit

Permalink
Auto-updated by master commit to modio-restapi
Browse files Browse the repository at this point in the history
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
zanderwar authored and github-actions[bot] committed Sep 12, 2023
1 parent 8b38045 commit 56aab22
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions source/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,136 @@ Status|Meaning|Error Ref|Description|Response Schema
To perform this request, you must be authenticated via one of the following methods:
<a href="#authentication">api_key</a>
</aside>
## GOG Galaxy

> Example request

```shell
# You can also use wget
curl -X POST https://*.modapi.io/v1/external/galaxyauth?api_key=YourApiKey \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json' \
--data-urlencode 'appdata=GCL671bwZ/+zUeOWc0M'

```

```http
POST https://*.modapi.io/v1/external/galaxyauth?api_key=YourApiKey HTTP/1.1
Host: *.modapi.io
Content-Type: application/x-www-form-urlencoded
Accept: application/json

```

```javascript
var headers = {
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'

};

$.ajax({
url: 'https://*.modapi.io/v1/external/galaxyauth',
method: 'post',
data: '?api_key=YourApiKey',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
```

```javascript--nodejs
const request = require('node-fetch');
const inputBody = '{
"appdata": "GCL671bwZ/+zUeOWc0M"
}';
const headers = {
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'

};

fetch('https://*.modapi.io/v1/external/galaxyauth?api_key=YourApiKey',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
```

```python
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
}

r = requests.post('https://*.modapi.io/v1/external/galaxyauth', params={
'api_key': 'YourApiKey'
}, headers = headers)

print r.json()
```

```java
URL obj = new URL("https://*.modapi.io/v1/external/galaxyauth?api_key=YourApiKey");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

`POST /external/galaxyauth`

Request an access token on behalf of a GOG Galaxy user. To use this functionality you *must* add your games [encrypted app ticket key](https://devportal.gog.com/welcome) from GOG Galaxy, to the *Game Admin > Settings* page of your games profile on mod.io. A Successful request will return an [Access Token Object](#access-token-object).

Parameter|Type|Required|Description
---|---|---|---|
appdata|string|true|The GOG Galaxy users [Encrypted App Ticket](https://cdn.gog.com/open/galaxy/sdk/1.133.3/Documentation/classgalaxy_1_1api_1_1IUser.html#a352802aab7a6e71b1cd1b9b1adfd53d8) provided by the GOG Galaxy SDK. <br><br>Parameter content *MUST* be the encrypted string returned in the buffer after calling [IUser::GetEncryptedAppTicket()](https://cdn.gog.com/open/galaxy/sdk/1.133.3/Documentation/classgalaxy_1_1api_1_1IUser.html#a96af6792efc260e75daebedca2cf74c6) within the Galaxy SDK. Unlike the [Steam Authentication](#steam) endpoint, you do not need to encode the encrypted string as this is already done by the Galaxy SDK.<br><br>__NOTE:__ Due to the encrypted app ticket containing special characters, you must URL encode the string before sending the request to ensure it is successfully sent to our servers otherwise you may encounter an `422 Unprocessable Entity` response. For example, [cURL](https://ec.haxx.se/http-post.html) will do this for you by using the `--data-urlencode` option.
email|string||The users email address. If supplied, and the respective user does not have an email registered for their account we will send a confirmation email to confirm they have ownership of the specified email.<br><br>__WARNING__: We __strongly recommend__ that you prompt your users in a friendly manner at least once to provide their email address to link their GOG Galaxy account to mod.io. Failing to provide an email will in-effect generate an orphan account that will only be able to be accessed from GOG Galaxy.
date_expires|integer||Unix timestamp of date in which the returned token will expire. Value cannot be higher than the default value which is a common year (unix timestamp + 31536000 seconds). Using a token after it's expiry time has elapsed will result in a `401 Unauthorized` response.
terms_agreed|boolean||This MUST be set to `false` unless you have collected the [users agreement](#terms) prior to calling this endpoint in which case it can be set to `true` and will be recorded.<br><br>__NOTE:__ If this is set to `false` and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error `403 Forbidden (error_ref 11074)` will be returned and you will need to collect the [users agreement](#terms) and retry with this value set to `true` to authenticate the user.

> Example response

```json
{
"code": 200,
"access_token": "eyJ0eXAiOiXKV1QibCJhbLciOiJeiUzI1.....",
"date_expires": 1570673249
}

```
<h3 id="GOG-Galaxy-responses">Responses</h3>

Status|Meaning|Error Ref|Description|Response Schema
---|---|----|---|---|
200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)||Successful Request|[Access Token Object](#schemaaccess_token_object)
401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|14001|The game associated with the supplied api_key is currently not available.|[Error Object](#schemaerror_object)
401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|11021|The GOG Galaxy encrypted app ticket was invalid.|[Error Object](#schemaerror_object)
401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|11032|mod.io was unable to verify the credentials against the external service provider.|[Error Object](#schemaerror_object)
403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|11016|The api_key supplied in the request must be associated with a game.|[Error Object](#schemaerror_object)
403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|11017|The api_key supplied in the request is for test environment purposes only and cannot be used for this functionality.|[Error Object](#schemaerror_object)
403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|11022|The secret GOG Galaxy app ticket associated with this game has not been configured.|[Error Object](#schemaerror_object)
403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|11074|The user has not agreed to the mod.io Terms of Use. Please see terms_agreed parameter description and the [Terms](#terms) endpoint for more information.|[Error Object](#schemaerror_object)
<aside class="auth-notice">
To perform this request, you must be authenticated via one of the following methods:
<a href="#authentication">api_key</a>
</aside>
## Google

> Example request
Expand Down

0 comments on commit 56aab22

Please sign in to comment.