diff options
| author | Ken <kenny@madgloryint.com> | 2017-11-01 13:27:17 -0400 |
|---|---|---|
| committer | Ken <kenny@madgloryint.com> | 2017-11-01 13:27:17 -0400 |
| commit | 1385a3cefc7312a3f18e8d78a854411b53c75e67 (patch) | |
| tree | f27292fc20215f68c25ab09830947da56fb732a9 /source/authorization/authorization.rst | |
| parent | 0f19a09673be2bb79426e21a6460d5095f43287a (diff) | |
| download | vainglory-docs-1385a3cefc7312a3f18e8d78a854411b53c75e67.tar.gz vainglory-docs-1385a3cefc7312a3f18e8d78a854411b53c75e67.zip | |
Initial commit of the new logs.
Diffstat (limited to 'source/authorization/authorization.rst')
| -rw-r--r-- | source/authorization/authorization.rst | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/source/authorization/authorization.rst b/source/authorization/authorization.rst new file mode 100644 index 0000000..5e381a6 --- /dev/null +++ b/source/authorization/authorization.rst @@ -0,0 +1,68 @@ +.. _authorization: + +Authorization +============= + +We require a JSON Web Token `JWT <https://jwt.io/>`_. be sent along with your request via the Authorization header. +JWTs are passed as bearer tokens in the Authorization header, and look like the following: + +``Authorization: <Enter your API Key>`` + +There's no need to create JWTs manually, they will be created for you when you register for the API - `Register Here! <https://developer.vainglorygame.com/users/sign_in/>`_. In some cases an ``X-API-KEY`` will give you more access to information, and in all cases it means that you are operating under a per-token rate limit. + +To specify the Headers, use this code: + +**Shell** + +.. code-block:: shell + + + # With shell, you can just pass the correct header with each request + curl "<endpoint-url>" \ + -H "Authorization: <api-key>" + -H "Accept: application/vnd.api+json" + +**Java:** + +.. code-block:: java + + import java.io.*; + import java.net.*; + + URL url = new URL("<endpoint-url>"); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + conn.setRequestProperty("Authorization","<api-key>"); + conn.setRequestProperty("Accept", "application/vnd.api+json"); + + conn.getInputStream() + +**Python:** + +.. code-block:: python + + import requests + + url = "<endpoint-url>" + + header = { + "Authorization": "<api-key>", + "Accept": "application/vnd.api+json" + } + + r = requests.get(url, headers=header) + +**Go:** + +.. code-block:: go + + import "net/http" + + client := &http.Client{} + req, _ := http.NewRequest("GET","<endpoint-url>",nil) + req.Header.Set("Authorization", "<api-key>") + req.Header.Set("Accept", "application/vnd.api+json") + res, _ := client.Do(req) + +.. toctree:: + :maxdepth: 2 |
