244
244
/**
245
245
* @OA\Post(
246
246
* path="/oauth/token",
247
- * summary="Requests a refresh token",
247
+ * summary="Request access token",
248
+ * description="User can request access token with their password or refresh token",
248
249
* tags={"OAuth"},
249
250
* operationId="refreshToken",
250
251
* requestBody={"$ref": "#/components/requestBodies/TokenRequest"},
251
252
* @OA\Response(
252
253
* response=200,
253
254
* description="successful operation",
255
+ * @OA\JsonContent(
256
+ * ref="#/components/schemas/TokenResponse"
257
+ * )
254
258
* )
255
259
* )
256
260
*/
265
269
* response=200,
266
270
* description="successful operation",
267
271
* @OA\Schema(
268
- * type="array ",
272
+ * type="object ",
269
273
* @OA\Items(ref="#/components/schemas/Token")
270
274
* )
271
275
* )
@@ -544,7 +548,7 @@ class ClientRequest
544
548
/**
545
549
* @OA\RequestBody(
546
550
* request="TokenRequest",
547
- * description="... ",
551
+ * description="Request access token with password or refresh token ",
548
552
* required=true,
549
553
* @OA\JsonContent(ref="#/components/schemas/TokenRequest")
550
554
* )
@@ -555,69 +559,99 @@ class TokenRequest
555
559
/**
556
560
* @OA\Schema(
557
561
* schema="TokenRequest",
558
- * @OA\Parameter(
559
- * name="grant_type",
560
- * in="formData",
562
+ * title="Token Request",
563
+ * description="Request body for requesting access token. Use grant type to define which authentication method is used.",
564
+ * required={
565
+ * "grant_type",
566
+ * "client_id",
567
+ * "client_secret",
568
+ * "scope",
569
+ * },
570
+ * @OA\Property(
571
+ * title="Grant type",
572
+ * property="grant_type",
561
573
* description="refresh_token or password",
562
- * required=true,
563
- * @OA\Schema(
564
- * type="string"
565
- * )
574
+ * type="string",
575
+ * enum={"refresh_token", "password"}
566
576
* ),
567
- * @OA\Parameter (
568
- * name="client_id ",
569
- * in="formData ",
577
+ * @OA\Property (
578
+ * title="Client ID ",
579
+ * property="client_id ",
570
580
* description="OAuth Client ID",
571
- * required=true,
572
- * @OA\Schema(
573
- * type="string"
574
- * )
581
+ * type="string"
575
582
* ),
576
- * @OA\Parameter (
577
- * name="client_secret ",
578
- * in="formData ",
583
+ * @OA\Property (
584
+ * title="Client secret ",
585
+ * property="client_secret ",
579
586
* description="OAuth Client Secret",
580
- * required=true,
581
- * @OA\Schema(
582
- * type="string"
583
- * )
587
+ * type="string"
584
588
* ),
585
- * @OA\Parameter (
586
- * name="scope ",
587
- * in="query ",
589
+ * @OA\Property (
590
+ * title="Scope ",
591
+ * property="scope ",
588
592
* description="What scopes are requested, for all, use '*'",
589
- * required=true,
590
- * @OA\Schema(
591
- * type="string"
592
- * )
593
+ * type="string"
593
594
* ),
594
- * @OA\Parameter (
595
- * name="refresh_token ",
596
- * in="formData ",
595
+ * @OA\Property (
596
+ * title="Refresh token ",
597
+ * property="refresh_token ",
597
598
* description="Refresh_token from the authorization response",
598
- * required=false,
599
- * @OA\Schema(
600
- * type="string"
601
- * )
599
+ * type="string"
602
600
* ),
603
- * @OA\Parameter (
604
- * name="username ",
605
- * in="formData ",
601
+ * @OA\Property (
602
+ * title="User name ",
603
+ * property="username ",
606
604
* description="Username for login",
607
- * required=false,
608
- * @OA\Schema(
609
- * type="string"
610
- * )
605
+ * type="string"
611
606
* ),
612
- * @OA\Parameter (
613
- * name ="password",
614
- * in="formData ",
607
+ * @OA\Property (
608
+ * title ="password",
609
+ * property="password ",
615
610
* description="Password for the user",
616
- * required=false,
617
- * @OA\Schema(
618
- * type="string"
619
- * )
611
+ * type="string"
620
612
* ),
621
613
* )
622
614
*/
623
615
}
616
+
617
+ class TokenResponse
618
+ {
619
+ /**
620
+ * @OA\Schema(
621
+ * schema="TokenResponse",
622
+ * title="Token Response",
623
+ * description="Response body when requesting access token.",
624
+ * required={
625
+ * "token_type",
626
+ * "expires_in",
627
+ * "access_token",
628
+ * "refresh_token",
629
+ * },
630
+ * @OA\Property(
631
+ * title="Token type",
632
+ * property="token_type",
633
+ * description="For example Bearer token type",
634
+ * type="string",
635
+ * enum={"Bearer"}
636
+ * ),
637
+ * @OA\Property(
638
+ * title="Expires in",
639
+ * property="expires_in",
640
+ * description="Token expires in this many seconds",
641
+ * type="string"
642
+ * ),
643
+ * @OA\Property(
644
+ * title="Access token",
645
+ * property="access_token",
646
+ * description="Access token",
647
+ * type="string"
648
+ * ),
649
+ * @OA\Property(
650
+ * title="Refresh token",
651
+ * property="refresh_token",
652
+ * description="Token used for refreshing access",
653
+ * type="string"
654
+ * ),
655
+ * )
656
+ */
657
+ }
0 commit comments