@@ -8,9 +8,9 @@ The token system requires usage of the mobile app or webextension (or a compatib
This should contain all that's needed to implement a user agent implementation able to use our token system. Feel free to contact us, should you plan tinker around with it.
## tokenautorization cookie
## tokenauthorization cookie
In order to use the token system, the user agent needs to set a cookie named "tokenautorization" which signifies the key's current fill level (because the MetaGer server can't know it):
In order to use the token system, the user agent needs to set a cookie named "tokenauthorization" which signifies the key's current fill level (because the MetaGer server can't know it):
| cookie value | number of tokens in key remaining |
@@ -19,3 +19,16 @@ In order to use the token system, the user agent needs to set a cookie named "to
| full | over 30 |
If this cookie isn't set, the token system will not work.
## token cost
When answering an initial MetaGer search query, the server will set a "cost" cookie if it detects a tokenauthorizsation cookie in the request. It will also redirect to the url from with to receive the actual search results.
The cookie contains the required number of tokens for the current search. A matching number of valid tokens needs to be sent during the request to the redirect target.
## sending tokens
Tokens are sent via the "tokens" http header. They are encoded as a JSON array of objects containing the token components. Those have to be retrieved from our [key server](https://gitlab.metager.de/open-source/metager-keymanager/-/blob/main/docs/api.md).