Update Anonymous Token System authored by Phil Höfer's avatar Phil Höfer
......@@ -4,15 +4,15 @@ With our anonymous token system, we allow users to use our paid ad-free service
The token system requires usage of the mobile app or webextension (or a compatible third-party implementation).
# Protocol (MetaGer usage)
# Protocol (MetaGer Usage)
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.
## tokenauthorization cookie
## Tokenauthorization Cookie
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 |
| Cookie Value | Number of Tokens in Key Remaining |
|--------------|-----------------------------------|
| empty | 0 |
| low | 30 or less |
......@@ -20,13 +20,13 @@ In order to use the token system, the user agent needs to set a cookie named "to
If this cookie isn't set, the token system will not work.
## token cost
## 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
## 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).
......@@ -41,6 +41,6 @@ Tokens are sent via the "tokens" http header. They are encoded as a JSON array o
]
```
## extraneous tokens
## Extraneous Tokens
If more tokes are sent then required for a search the server will set a "tokens" cookie that contains those unused tokens. We strongly recommend reading those from the cookie and deleting it afterwards.
\ No newline at end of file