Debian Codegraph @

docs/src/tutorial/authentication/apikey03.py

raw symbols SCIP
1 from ninja.security import APIKeyCookie
2
3
4 class CookieKey(APIKeyCookie):
5 def authenticate(self, request, key):
6 if key == "supersecret":
7 return key
8
9
10 cookie_key = CookieKey()
11
12
13 @api.get("/cookiekey", auth=cookie_key)
14 def apikey(request):
15 return f"Token = {request.auth}"