-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from AppFlowy-IO/feat/openapi-oauth-doc
feat: add oauth redirect token api
- Loading branch information
Showing
7 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# OAuthApi | ||
|
||
All URIs are relative to *https://beta.appflowy.cloud* | ||
|
||
| Method | HTTP request | Description | | ||
|------------- | ------------- | -------------| | ||
| [**gotrueToken**](OAuthApi.md#gotrueToken) | **POST** /gotrue/token | Get a new access token and refresh token based on grant type | | ||
| [**oauthRedirectToken**](OAuthApi.md#oauthRedirectToken) | **GET** /web-api/oauth-redirect/token | Sign in with AppFlowy OAuth 2.0 | | ||
|
||
|
||
<a name="gotrueToken"></a> | ||
# **gotrueToken** | ||
> gotrue_token_response gotrueToken(grant\_type, gotrueToken\_request) | ||
Get a new access token and refresh token based on grant type | ||
|
||
This endpoint is used to obtain a new access token and refresh token based on the grant type. | ||
|
||
### Parameters | ||
|
||
|Name | Type | Description | Notes | | ||
|------------- | ------------- | ------------- | -------------| | ||
| **grant\_type** | **String**| The grant type of the OAuth 2.0 flow being used to obtain an access token. This can be one of the following: - `refresh_token`: Used to exchange a refresh token for an access token. - `password`: Used to exchange a username and password for an access token. - `id_token`: Used to exchange an ID token for an access token. - `pkce`: Used to exchange an authorization code for an access token. | [default to null] | | ||
| **gotrueToken\_request** | [**gotrueToken_request**](../Models/gotrueToken_request.md)| The request body for obtaining an access token | | | ||
|
||
### Return type | ||
|
||
[**gotrue_token_response**](../Models/gotrue_token_response.md) | ||
|
||
### Authorization | ||
|
||
No authorization required | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: application/json | ||
- **Accept**: application/json | ||
|
||
<a name="oauthRedirectToken"></a> | ||
# **oauthRedirectToken** | ||
> gotrue_token_response oauthRedirectToken(code, grant\_type, client\_id, client\_secret, redirect\_uri, code\_verifier) | ||
Sign in with AppFlowy OAuth 2.0 | ||
|
||
This endpoint is used obtain an access token from AppFlowy OAuth 2.0. This is called after user tried to sign in with AppFlowy OAuth (/web-api/oauth-redirect). This is primarily used integration with third-party applications. | ||
|
||
### Parameters | ||
|
||
|Name | Type | Description | Notes | | ||
|------------- | ------------- | ------------- | -------------| | ||
| **code** | **String**| The authorization code received from the redirect. | [default to null] | | ||
| **grant\_type** | **String**| Type of OAuth 2.0 flow being used to exchange the authorization code for an access token. | [default to null] | | ||
| **client\_id** | **String**| The client ID of the application | [optional] [default to null] | | ||
| **client\_secret** | **String**| The client's secret (if applicable, for confidential clients). | [optional] [default to null] | | ||
| **redirect\_uri** | **String**| The redirect URI used in the initial authorization request. | [optional] [default to null] | | ||
| **code\_verifier** | **String**| Used in PKCE (Proof Key for Code Exchange) to secure public clients. | [optional] [default to null] | | ||
|
||
### Return type | ||
|
||
[**gotrue_token_response**](../Models/gotrue_token_response.md) | ||
|
||
### Authorization | ||
|
||
No authorization required | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: Not defined | ||
- **Accept**: application/json | ||
|
9 changes: 9 additions & 0 deletions
9
documentation/appflowy-cloud/openapi/Models/gotrue_token_response.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# gotrue_token_response | ||
## Properties | ||
|
||
| Name | Type | Description | Notes | | ||
|------------ | ------------- | ------------- | -------------| | ||
| **access\_token** | **String** | The token that clients use to make authenticated requests to the server or API. It is a bearer token that provides temporary, secure access to server resources. | [optional] [default to null] | | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
documentation/appflowy-cloud/openapi/components/gotrue_token_response.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
type: object | ||
properties: | ||
access_token: | ||
type: string | ||
description: > | ||
The token that clients use to make authenticated requests to the server or API. | ||
It is a bearer token that provides temporary, secure access to server resources. | ||
token_type: | ||
type: string | ||
description: > | ||
The type of token. It is always "Bearer". | ||
expires_in: | ||
type: integer | ||
description: > | ||
Seconds until the access_token expires. | ||
expires_at: | ||
type: integer | ||
description: > | ||
A timestamp in seconds indicating the exact time at which the access_token will expire. | ||
refresh_token: | ||
type: string | ||
description: > | ||
The refresh token is used to obtain a new access_token once the current access_token expires. | ||
Refresh tokens are usually long-lived and are stored securely by the client. | ||
user: | ||
type: object | ||
description: > | ||
The user object contains information about the user that is currently authenticated. | ||
provider_access_token: | ||
type: string | ||
description: > | ||
The access token from the provider. | ||
provider_refresh_token: | ||
type: string | ||
description: > | ||
The refresh token from the provider. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
documentation/appflowy-cloud/openapi/paths/oauth_redirect_token.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
get: | ||
summary: Sign in with AppFlowy OAuth 2.0 | ||
description: > | ||
This endpoint is used obtain an access token from AppFlowy OAuth 2.0. | ||
This is called after user tried to sign in with AppFlowy OAuth (/web-api/oauth-redirect). | ||
This is primarily used integration with third-party applications. | ||
operationId: oauthRedirectToken | ||
tags: | ||
- OAuth | ||
parameters: | ||
- name: code | ||
in: query | ||
description: The authorization code received from the redirect. | ||
required: true | ||
schema: | ||
type: string | ||
- name: client_id | ||
in: query | ||
description: The client ID of the application | ||
required: false | ||
schema: | ||
type: string | ||
- name: client_secret | ||
in: query | ||
description: The client's secret (if applicable, for confidential clients). | ||
required: false | ||
schema: | ||
type: string | ||
- name: grant_type | ||
in: query | ||
description: Type of OAuth 2.0 flow being used to exchange the authorization code for an access token. | ||
required: true | ||
schema: | ||
type: string | ||
- name: redirect_uri | ||
in: query | ||
description: The redirect URI used in the initial authorization request. | ||
required: false | ||
schema: | ||
type: string | ||
- name: code_verifier | ||
in: query | ||
description: Used in PKCE (Proof Key for Code Exchange) to secure public clients. | ||
required: false | ||
schema: | ||
type: string | ||
|
||
responses: | ||
'200': | ||
description: Successfully obtained an access token | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../components/gotrue_token_response.yaml' |