diff --git a/apiserver/plane/api/serializers/api_token.py b/apiserver/plane/api/serializers/api_token.py index 247b3f0e7..9c363f895 100644 --- a/apiserver/plane/api/serializers/api_token.py +++ b/apiserver/plane/api/serializers/api_token.py @@ -5,4 +5,10 @@ from plane.db.models import APIToken class APITokenSerializer(BaseSerializer): class Meta: model = APIToken - fields = "__all__" + fields = [ + "label", + "user", + "user_type", + "workspace", + "created_at", + ] diff --git a/apiserver/plane/api/views/api_token.py b/apiserver/plane/api/views/api_token.py index 2508b06ac..a94ffb45c 100644 --- a/apiserver/plane/api/views/api_token.py +++ b/apiserver/plane/api/views/api_token.py @@ -28,7 +28,11 @@ class ApiTokenEndpoint(BaseAPIView): ) serializer = APITokenSerializer(api_token) - return Response(serializer.data, status=status.HTTP_201_CREATED) + # Token will be only vissible while creating + return Response( + {"api_token": serializer.data, "token": api_token.token}, + status=status.HTTP_201_CREATED, + ) except Exception as e: capture_exception(e)