Closed BECATRUE closed 6 days ago
This resolves #4.
I implemented three APIs.
user/signin/
user/signout/
user/me
One can test these features using the code below.
import requests BASE_URL = 'http://localhost:8000' with requests.Session() as session: data = {'username': 'jaehun', 'password': 'OOOO'} response = session.post(BASE_URL + '/user/signin/', data=data) print(response.status_code) # 200 csrf_token = session.cookies.get('csrftoken') headers = {'X-CSRFToken': csrf_token} response = session.get(BASE_URL + '/user/me/', headers=headers) print(response.json()) # {'id': 3, 'username': 'jaehun', 'password': 'OOOO', 'team': {'id': 1, 'name': 'blade'}} # 'password' is hashed. response = session.post(BASE_URL + '/user/signout/', headers=headers) print(response.status_code) # 200
This resolves #4.
I implemented three APIs.
user/signin/
: Try to sign-in with username and password.user/signout/
: Sign-out with user info stored in Django server.user/me
: Get my info using custom serializer.One can test these features using the code below.