Add oAuth
This commit is contained in:
parent
23219e6fb3
commit
0aa24a150b
|
@ -22,7 +22,21 @@ def spec do
|
||||||
version: Application.spec(:pleroma, :vsn) |> to_string()
|
version: Application.spec(:pleroma, :vsn) |> to_string()
|
||||||
},
|
},
|
||||||
# populate the paths from a phoenix router
|
# populate the paths from a phoenix router
|
||||||
paths: OpenApiSpex.Paths.from_router(Router)
|
paths: OpenApiSpex.Paths.from_router(Router),
|
||||||
|
components: %OpenApiSpex.Components{
|
||||||
|
securitySchemes: %{
|
||||||
|
"oAuth" => %OpenApiSpex.SecurityScheme{
|
||||||
|
type: "oauth2",
|
||||||
|
flows: %OpenApiSpex.OAuthFlows{
|
||||||
|
password: %OpenApiSpex.OAuthFlow{
|
||||||
|
authorizationUrl: "/oauth/authorize",
|
||||||
|
tokenUrl: "/oauth/token",
|
||||||
|
scopes: %{"read" => "read"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# discover request/response schemas from path specs
|
# discover request/response schemas from path specs
|
||||||
|> OpenApiSpex.resolve_schema_modules()
|
|> OpenApiSpex.resolve_schema_modules()
|
||||||
|
|
|
@ -51,8 +51,10 @@ def verify_credentials_operation do
|
||||||
summary: "Verify your app works",
|
summary: "Verify your app works",
|
||||||
description: "Confirm that the app's OAuth2 credentials work.",
|
description: "Confirm that the app's OAuth2 credentials work.",
|
||||||
operationId: "AppController.verify_credentials",
|
operationId: "AppController.verify_credentials",
|
||||||
parameters: [
|
security: [
|
||||||
Operation.parameter(:authorization, :header, :string, "Bearer <app token>", required: true)
|
%{
|
||||||
|
"oAuth" => ["read"]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 =>
|
200 =>
|
||||||
|
|
Loading…
Reference in a new issue