add v2 session auth api
This commit is contained in:
parent
33ce843d33
commit
0fe724e3e1
2 changed files with 18 additions and 0 deletions
16
src/c3nav/api/newapi.py
Normal file
16
src/c3nav/api/newapi.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from django.conf import settings
|
||||
from ninja import Router as APIRouter
|
||||
from ninja import Schema
|
||||
|
||||
auth_api_router = APIRouter(tags=["auth"])
|
||||
|
||||
|
||||
class APITokenSchema(Schema):
|
||||
token: str
|
||||
|
||||
|
||||
@auth_api_router.get('/session/', response=APITokenSchema,
|
||||
summary="Get session API token")
|
||||
def session_token(request):
|
||||
print()
|
||||
return {"token": request.COOKIES.get(settings.SESSION_COOKIE_NAME, 'anonymous')}
|
Loading…
Add table
Add a link
Reference in a new issue