Skip to content

Commit 8778197

Browse files
committed
Update public oauth route descriptions
* Also update Passport version number
1 parent cc96976 commit 8778197

File tree

2 files changed

+87
-53
lines changed

2 files changed

+87
-53
lines changed

LooseAnnotations/OAuth.php

+86-52
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,17 @@
244244
/**
245245
* @OA\Post(
246246
* 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",
248249
* tags={"OAuth"},
249250
* operationId="refreshToken",
250251
* requestBody={"$ref": "#/components/requestBodies/TokenRequest"},
251252
* @OA\Response(
252253
* response=200,
253254
* description="successful operation",
255+
* @OA\JsonContent(
256+
* ref="#/components/schemas/TokenResponse"
257+
* )
254258
* )
255259
* )
256260
*/
@@ -265,7 +269,7 @@
265269
* response=200,
266270
* description="successful operation",
267271
* @OA\Schema(
268-
* type="array",
272+
* type="object",
269273
* @OA\Items(ref="#/components/schemas/Token")
270274
* )
271275
* )
@@ -544,7 +548,7 @@ class ClientRequest
544548
/**
545549
* @OA\RequestBody(
546550
* request="TokenRequest",
547-
* description="...",
551+
* description="Request access token with password or refresh token",
548552
* required=true,
549553
* @OA\JsonContent(ref="#/components/schemas/TokenRequest")
550554
* )
@@ -555,69 +559,99 @@ class TokenRequest
555559
/**
556560
* @OA\Schema(
557561
* 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",
561573
* description="refresh_token or password",
562-
* required=true,
563-
* @OA\Schema(
564-
* type="string"
565-
* )
574+
* type="string",
575+
* enum={"refresh_token", "password"}
566576
* ),
567-
* @OA\Parameter(
568-
* name="client_id",
569-
* in="formData",
577+
* @OA\Property(
578+
* title="Client ID",
579+
* property="client_id",
570580
* description="OAuth Client ID",
571-
* required=true,
572-
* @OA\Schema(
573-
* type="string"
574-
* )
581+
* type="string"
575582
* ),
576-
* @OA\Parameter(
577-
* name="client_secret",
578-
* in="formData",
583+
* @OA\Property(
584+
* title="Client secret",
585+
* property="client_secret",
579586
* description="OAuth Client Secret",
580-
* required=true,
581-
* @OA\Schema(
582-
* type="string"
583-
* )
587+
* type="string"
584588
* ),
585-
* @OA\Parameter(
586-
* name="scope",
587-
* in="query",
589+
* @OA\Property(
590+
* title="Scope",
591+
* property="scope",
588592
* description="What scopes are requested, for all, use '*'",
589-
* required=true,
590-
* @OA\Schema(
591-
* type="string"
592-
* )
593+
* type="string"
593594
* ),
594-
* @OA\Parameter(
595-
* name="refresh_token",
596-
* in="formData",
595+
* @OA\Property(
596+
* title="Refresh token",
597+
* property="refresh_token",
597598
* description="Refresh_token from the authorization response",
598-
* required=false,
599-
* @OA\Schema(
600-
* type="string"
601-
* )
599+
* type="string"
602600
* ),
603-
* @OA\Parameter(
604-
* name="username",
605-
* in="formData",
601+
* @OA\Property(
602+
* title="User name",
603+
* property="username",
606604
* description="Username for login",
607-
* required=false,
608-
* @OA\Schema(
609-
* type="string"
610-
* )
605+
* type="string"
611606
* ),
612-
* @OA\Parameter(
613-
* name="password",
614-
* in="formData",
607+
* @OA\Property(
608+
* title="password",
609+
* property="password",
615610
* description="Password for the user",
616-
* required=false,
617-
* @OA\Schema(
618-
* type="string"
619-
* )
611+
* type="string"
620612
* ),
621613
* )
622614
*/
623615
}
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+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpenAPI 3.0 Annotations for Laravel Passport 4
1+
# OpenAPI 3.0 Annotations for Laravel Passport 7
22

33
For the time being this is a bit untested work for Laravel Passport to get OpenAPI OAuth definitions done.
44

0 commit comments

Comments
 (0)