> For the complete documentation index, see [llms.txt](https://meetgo.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://meetgo.gitbook.io/api/member/permission.md).

# permission

## For Frontend

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

```
Authorization:Token a48d7daa206881756db5a832c467441d24ed15b8
```

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

```javascript
// 헤더에 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

이메일 인증하지 **않은** 유저에게 권한을 주기 위해서는 다음과 같이 사용합니다.

```python
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated

class Test(APIView):
    permission_classes = (IsAuthenticated, )
    # ...
```

**이메일 인증을 완료**한 유저에게 권한을 주기 위해서는 다음과 같이 사용합니다.

```python
from rest_framework.views import APIView
from member.permissions import UserPermission

class Test(APIView):
    permission_classes = (UserPermission, )
    # ...
```
