// 헤더에 Authorization이 없는 경우, 401 Unauthorized
{
"detail": "Authentication credentials were not provided."
}
// 토큰 값이 유효하지 않은 경우, 401 Unauthorized
{
"detail": "Invalid token."
}
// 이메일 인증을 하지 않은 유저일 경우, 403 Forbidden
{
"detail": "You do not have permission to perform this action."
}
For Backend
이메일 인증하지 않은 유저에게 권한을 주기 위해서는 다음과 같이 사용합니다.
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
class Test(APIView):
permission_classes = (IsAuthenticated, )
# ...
이메일 인증을 완료한 유저에게 권한을 주기 위해서는 다음과 같이 사용합니다.
from rest_framework.views import APIView
from member.permissions import UserPermission
class Test(APIView):
permission_classes = (UserPermission, )
# ...