@@ 8,11 8,14 @@ from srht.database import db
from srht.oauth import OAuthError, UserType
from srht.oauth.scope import OAuthScope
from srht.validation import Validation
+from prometheus_client import Counter
import hashlib
import requests
metasrht = get_origin("meta.sr.ht")
+deprecated_oauth_counter = Counter("deprecated_oauth", "Deprecated legacy OAuth token use")
+
def _internal_auth(f, auth, *args, **kwargs):
# Used for authenticating internal API users, like other sr.ht sites.
oauth_service = current_app.oauth_service
@@ 84,6 87,7 @@ def oauth(scopes):
token = token[1]
token_hash = hashlib.sha512(token.encode()).hexdigest()
+ deprecated_auth_counter.inc()
try:
if scopes: