Fixed Security endpoints

This commit is contained in:
Luke Hagar
2023-04-13 20:36:26 -05:00
parent 1e72c1a7dc
commit 1d46abe100
8 changed files with 66 additions and 63 deletions

View File

@@ -3,7 +3,8 @@
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json": [
"file:///Users/luke.hagar/Documents/GitHub/plex-api-spec/paths/root.yaml",
"file:///c%3A/Users/Luke/Documents/GitHub/plex-api-spec/referenced/plex-api-spec.yaml",
"file:///c%3A/Users/Luke/Documents/GitHub/plex-api-spec/referenced/paths/resources.yaml"
"file:///c%3A/Users/Luke/Documents/GitHub/plex-api-spec/referenced/paths/resources.yaml",
"file:///c%3A/Users/Luke/Documents/GitHub/plex-api-spec/plex-api-spec-dereferenced.yaml"
]
}
}

View File

@@ -1,10 +1,12 @@
get:
tags:
- Authentication
get:
tags:
- Authentication
summary: Get Access Token
operationId: getToken
description: Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
parameters:
security:
- $ref: "../../security/PlexClientIdentifier.yaml"
parameters:
- name: pinID
description: The PinID to retrieve an access token for
in: path
@@ -18,8 +20,8 @@ get:
- $ref: "../../parameters/X-Plex-Product.yaml"
- $ref: "../../parameters/X-Plex-Provides.yaml"
- $ref: "../../parameters/X-Plex-Version.yaml"
responses:
responses:
"200":
description: Access Token
"401":
$ref: "../../responses/401.yaml"
$ref: "../../responses/401.yaml"

View File

@@ -1,10 +1,12 @@
post:
tags:
- Authentication
post:
tags:
- Authentication
summary: Get a Pin
operationId: getPin
description: Retrieve a Pin from Plex.tv for authentication flows
parameters:
security:
- $ref: "../../security/PlexClientIdentifier.yaml"
parameters:
- name: strong
description: |
Determines the kind of code returned by the API call
@@ -22,102 +24,102 @@ post:
- $ref: "../../parameters/X-Plex-Product.yaml"
- $ref: "../../parameters/X-Plex-Provides.yaml"
- $ref: "../../parameters/X-Plex-Version.yaml"
responses:
responses:
"200":
description: The Pin
content:
content:
application/json:
schema:
schema:
type: object
properties:
id:
properties:
id:
description: PinID for use with authentication
type: number
example: 1272322473
code:
code:
type: string
example: 3patfx1a78ukcbr7x0n9bl26t
product:
product:
type: string
example: Plex Web
trusted:
trusted:
type: boolean
qr:
qr:
description: |
a link to a QR code hosted on plex.tv
The QR code redirects to the relevant `plex.tv/link` authentication page
Which then prompts the user for the 4 Digit Link Pin
type: string
example: https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t
clientIdentifier:
clientIdentifier:
type: string
example: Postman
location:
location:
type: object
properties:
code:
properties:
code:
type: string
example: US
european_union_member:
european_union_member:
type: boolean
continent_code:
continent_code:
type: string
example: NA
country:
country:
type: string
example: United States
city:
city:
type: string
example: Austin
time_zone:
time_zone:
type: string
example: America/Chicago
postal_code:
postal_code:
type: string
example: 78732
in_privacy_restricted_country:
in_privacy_restricted_country:
type: boolean
subdivisions:
subdivisions:
type: string
example: Texas
coordinates:
coordinates:
type: string
example: 30.3768 -97.8935
expiresIn:
expiresIn:
type: number
example: 1800
createdAt:
createdAt:
type: string
format: date-time
example: 2023-04-12T17:00:03Z
expiresAt:
expiresAt:
type: string
format: date-time
example: 2023-04-12T17:30:03Z
authToken:
authToken:
type: string
format: nullable
newRegistration:
newRegistration:
type: string
format: nullable
"400":
description: X-Plex-Client-Identifier is missing
content:
content:
application/json:
schema:
schema:
type: object
properties:
errors:
properties:
errors:
type: array
items:
items:
type: object
properties:
code:
properties:
code:
type: number
example: 1000
message:
message:
type: string
example: X-Plex-Client-Identifier is missing
status:
status:
type: number
example: 400
example: 400

View File

@@ -3,7 +3,7 @@ get:
- User
summary: Get Logged in User
description: Get Logged in User
operationId: getCurrentUserDetails
operationId: getUserDetails
parameters:
- $ref: "../../parameters/X-Plex-Device-Name.yaml"
- $ref: "../../parameters/X-Plex-Device.yaml"

View File

@@ -5,7 +5,7 @@ get:
description: |
If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
Note: requires Plex Media Server >= 1.15.4.
operationId: getConnectionInformation
operationId: getSourceConnectionInformation
parameters:
- name: source
description: The source identifier with an included prefix.

View File

@@ -1,7 +1,7 @@
put:
tags:
- Updater
summary: Applying updates
summary: Apply Updates
description: |
Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
operationId: applyUpdates

View File

@@ -11,10 +11,10 @@ info:
license:
name: MIT
identifier: MIT
url: https://opensource.org/licenses/MIT
url: https://opensource.org/licenses/MIT
servers:
- url: '{Protocol}://{Local IP}:{Port}'
- url: "{Protocol}://{Local IP}:{Port}"
variables:
Protocol:
enum:
@@ -44,9 +44,7 @@ components:
in: header # can be "header", "query" or "cookie"
name: X-Plex-Client-Identifier # name of the header, query parameter or cookie
paths:
# Plex Media Server endpoints
/:
@@ -116,11 +114,11 @@ paths:
/:/prefs:
$ref: "./paths/pms/server-preferences.yaml"
# Plex.tv API endpoints
# Plex.tv API endpoints
/user:
servers:
- url: https://plex.tv/api/v2
- url: https://plex.tv/api/v2
$ref: "./paths/plex.tv/user.yaml"
/resources:
servers:
@@ -129,14 +127,10 @@ paths:
/pins:
servers:
- url: https://plex.tv/api/v2
security:
- PlexClientIdentifier: []
$ref: "./paths/plex.tv/pins.yaml"
/pins/{pinID}:
servers:
- url: https://plex.tv/api/v2
security:
- PlexClientIdentifier: []
$ref: "./paths/plex.tv/pins-id.yaml"
tags:
@@ -151,7 +145,7 @@ tags:
- The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
- name: Authentication
description: |
API Calls regarding authentication for Plex Media Server
API Calls regarding authentication for Plex Media Server
- name: Butler
description: |
Butler is the task manager of the Plex Media Server Ecosystem.

View File

@@ -0,0 +1,4 @@
PlexClientIdentifier: # arbitrary name for the security scheme
type: apiKey
in: header # can be "header", "query" or "cookie"
name: X-Plex-Client-Identifier # name of the header, query parameter or cookie