permission

이메일 인증을 완료한 유저만 meetgo의 모든 기능을 이용할 수 있습니다.

For Frontend

유저 정보와 함께 API를 요청할 경우, 헤더에 토큰 정보를 포함해 요청합니다.

Authorization:Token a48d7daa206881756db5a832c467441d24ed15b8

인증을 성공하지 못하거나 권한이 없을 경우, 응답은 다음과 같습니다.

// 헤더에 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, )
    # ...

Last updated