> For the complete documentation index, see [llms.txt](https://docs.podplay.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podplay.app/api/users/oauth2.md).

# OAuth2

OAuth2 authentication and authorization flows.

## POST /oauth2/token

> OAuth2.0 Token Endpoint (<https://www.rfc-editor.org/rfc/rfc6749>)

```json
{"openapi":"3.0.0","info":{"title":"PodPlay Inc API","version":"2.0"},"tags":[{"name":"OAuth2","description":"OAuth2 authentication and authorization flows."}],"servers":[{"url":"/apis/v2","description":"Current Server"}],"paths":{"/oauth2/token":{"post":{"operationId":"Oauth2Controller_createAccessToken","summary":"OAuth2.0 Token Endpoint (https://www.rfc-editor.org/rfc/rfc6749)","parameters":[{"name":"authorization","required":false,"in":"header","description":"OAuth 2.0 Client Application - Basic Auth required for grant_type=authorization_code requests.","schema":{"type":"string"}},{"name":"utm_location","required":false,"in":"query","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/OAuth2AccessTokenRequestSwaggerExampleDto"}}}},"responses":{"201":{"description":"Returns a `OAuth2AccessToken`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuth2AccessTokenDto"}}}},"422":{"description":"Returns a `OAuth2AccessTokenError`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuth2AccessTokenErrorDto"}}}}},"tags":["OAuth2"]}}},"components":{"schemas":{"OAuth2AccessTokenRequestSwaggerExampleDto":{"type":"object","properties":{"grant_type":{"type":"string","enum":["password","refresh_token","authorization_code","passwordless_auth","mobile_webview_auth"]},"username":{"type":"string","writeOnly":true},"password":{"type":"string","writeOnly":true},"scope":{"type":"string","writeOnly":true},"refresh_token":{"type":"string","writeOnly":true},"code":{"type":"string","writeOnly":true},"redirect_uri":{"type":"string","writeOnly":true},"client_id":{"type":"string","writeOnly":true},"client_secret":{"type":"string","writeOnly":true}},"required":["grant_type"]},"OAuth2AccessTokenDto":{"type":"object","properties":{"access_token":{"type":"string","readOnly":true},"token_type":{"type":"string","enum":["bearer","custom"],"readOnly":true},"expires_in":{"type":"number","readOnly":true},"refresh_token":{"type":"string","readOnly":true},"scope":{"type":"string","readOnly":true}},"required":["access_token","token_type","expires_in","refresh_token"]},"OAuth2AccessTokenErrorDto":{"type":"object","properties":{"podify_required_agreements":{"readOnly":true,"allOf":[{"$ref":"#/components/schemas/ItemRefCollectionDto"}]},"errors":{"readOnly":true,"type":"array","items":{"$ref":"#/components/schemas/ValidationErrorDto"}}},"required":["errors"]},"ItemRefCollectionDto":{"type":"object","properties":{"items":{"description":"The array containing the elements of the collection","type":"array","items":{"type":"string"}},"_total":{"type":"number","description":"The total amount of elements in this collection, counting also the elements from the succesive pages"},"_links":{"description":"A `LinksDto` structure containing URL references to propertes that can be expanded","allOf":[{"$ref":"#/components/schemas/LinksDto"}]}},"required":["items"]},"LinksDto":{"type":"object","properties":{"self":{"description":"A `LinkDto` to the resource itself","allOf":[{"$ref":"#/components/schemas/LinkDto"}]}},"required":["self"]},"LinkDto":{"type":"object","properties":{"href":{"type":"string","description":"A URL"}},"required":["href"]},"ValidationErrorDto":{"type":"object","properties":{"code":{"type":"string","readOnly":true},"message":{"type":"string","readOnly":true},"details":{"type":"object","readOnly":true,"nullable":true}},"required":["code","message","details"]}}}}
```

## POST /oauth2/webview-token

> Custom Token Endpoint

```json
{"openapi":"3.0.0","info":{"title":"PodPlay Inc API","version":"2.0"},"tags":[{"name":"OAuth2","description":"OAuth2 authentication and authorization flows."}],"servers":[{"url":"/apis/v2","description":"Current Server"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"OAuth2AccessTokenRequestWebviewAuthDto":{"type":"object","properties":{"username":{"type":"string"},"grant_type":{"type":"string","enum":["mobile_webview_auth"]}},"required":["username","grant_type"]},"OAuth2AccessTokenDto":{"type":"object","properties":{"access_token":{"type":"string","readOnly":true},"token_type":{"type":"string","enum":["bearer","custom"],"readOnly":true},"expires_in":{"type":"number","readOnly":true},"refresh_token":{"type":"string","readOnly":true},"scope":{"type":"string","readOnly":true}},"required":["access_token","token_type","expires_in","refresh_token"]}}},"paths":{"/oauth2/webview-token":{"post":{"operationId":"Oauth2Controller_createWebViewToken","summary":"Custom Token Endpoint","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuth2AccessTokenRequestWebviewAuthDto"}}}},"responses":{"201":{"description":"Returns a `OAuth2AccessToken`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuth2AccessTokenDto"}}}}},"tags":["OAuth2"]}}}}
```

## POST /oauth2/discourse-connect/authorizations

>

```json
{"openapi":"3.0.0","info":{"title":"PodPlay Inc API","version":"2.0"},"tags":[{"name":"OAuth2","description":"OAuth2 authentication and authorization flows."}],"servers":[{"url":"/apis/v2","description":"Current Server"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"SSOAuthorizationDiscourseConnectDto":{"type":"object","properties":{"type":{"type":"string","enum":["DISCOURSE_CONNECT"]},"sso":{"type":"string"},"sig":{"type":"string"},"callbackUrl":{"type":"string","readOnly":true}},"required":["type","sso","sig","callbackUrl"]}}},"paths":{"/oauth2/discourse-connect/authorizations":{"post":{"operationId":"Oauth2Controller_createDiscourseConnectAuthorization","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SSOAuthorizationDiscourseConnectDto"}}}},"responses":{"201":{"description":"Returns a `SSOAuthorizationDiscourseConnect`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SSOAuthorizationDiscourseConnectDto"}}}}},"tags":["OAuth2"]}}}}
```

## POST /oauth2/authorizations

>

```json
{"openapi":"3.0.0","info":{"title":"PodPlay Inc API","version":"2.0"},"tags":[{"name":"OAuth2","description":"OAuth2 authentication and authorization flows."}],"servers":[{"url":"/apis/v2","description":"Current Server"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"SSOAuthorizationOauth2AuthorizationCodeDto":{"type":"object","properties":{"type":{"type":"string","enum":["OAUTH2_AUTHORIZATION_CODE"]},"clientId":{"type":"string"},"redirectUri":{"type":"string","writeOnly":true},"scope":{"type":"string"},"code":{"type":"string","readOnly":true},"callbackUrl":{"type":"string","readOnly":true}},"required":["type","clientId","redirectUri","code","callbackUrl"]}}},"paths":{"/oauth2/authorizations":{"post":{"operationId":"Oauth2Controller_createOauth2Authorization","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SSOAuthorizationOauth2AuthorizationCodeDto"}}}},"responses":{"201":{"description":"Returns a `SSOAuthorizationOauth2AuthorizationCode`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SSOAuthorizationOauth2AuthorizationCodeDto"}}}}},"tags":["OAuth2"]}}}}
```

## PATCH /oauth2/users/credentials

> User credentials reset: Initiates the user password reset flow.

```json
{"openapi":"3.0.0","info":{"title":"PodPlay Inc API","version":"2.0"},"tags":[{"name":"OAuth2","description":"OAuth2 authentication and authorization flows."}],"servers":[{"url":"/apis/v2","description":"Current Server"}],"paths":{"/oauth2/users/credentials":{"patch":{"operationId":"Oauth2Controller_initiateCredentialsUpdate","summary":"User credentials reset: Initiates the user password reset flow.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCredentialsPatchableDto"}}}},"responses":{"200":{"description":"Returns a `UserCredentialsPatchable`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCredentialsPatchableDto"}}}}},"tags":["OAuth2"]}}},"components":{"schemas":{"UserCredentialsPatchableDto":{"type":"object","properties":{"email":{"type":"string","format":"email","writeOnly":true}},"required":["email"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.podplay.app/api/users/oauth2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
