MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / post

Method post

api/oauth2_metadata/views.py:163–186  ·  view source on GitHub ↗
(self, request: Request)

Source from the content-addressed store, hash-verified

161 }
162
163 def post(self, request: Request) -> Response:
164 serializer = DCRRequestSerializer(data=request.data)
165 if not serializer.is_valid():
166 return self._rfc7591_error_response(serializer.errors)
167
168 data = serializer.validated_data
169
170 application = create_oauth2_application(
171 client_name=data["client_name"],
172 redirect_uris=data["redirect_uris"],
173 )
174
175 return Response(
176 {
177 "client_id": application.client_id,
178 "client_name": application.name,
179 "redirect_uris": data["redirect_uris"],
180 "grant_types": data["grant_types"],
181 "response_types": data["response_types"],
182 "token_endpoint_auth_method": data["token_endpoint_auth_method"],
183 "client_id_issued_at": int(application.created.timestamp()),
184 },
185 status=drf_status.HTTP_201_CREATED,
186 )
187
188 def _rfc7591_error_response(self, errors: dict[str, list[str]]) -> Response:
189 """Format validation errors per RFC 7591 section 3.2.2."""

Callers

nothing calls this directly

Calls 4

is_validMethod · 0.80

Tested by

no test coverage detected