Skip to content

Commit

Permalink
fix: add client_id and client_secret to revokeOAuth2Token
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas committed Nov 28, 2022
1 parent d7a28e9 commit 367154d
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 6 deletions.
12 changes: 12 additions & 0 deletions internal/httpclient/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4136,12 +4136,24 @@ components:
type: object
revokeOAuth2Token_request:
properties:
client_id:
required:
- client_id
type: string
x-formData-name: client_id
client_secret:
required:
- client_secret
type: string
x-formData-name: client_secret
token:
required:
- token
type: string
x-formData-name: token
required:
- client_id
- client_secret
- token
type: object
oauth2TokenExchange_request:
Expand Down
26 changes: 23 additions & 3 deletions internal/httpclient/api_o_auth2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions internal/httpclient/docs/OAuth2Api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@ No authorization required

## RevokeOAuth2Token

> RevokeOAuth2Token(ctx).Token(token).Execute()
> RevokeOAuth2Token(ctx).ClientId(clientId).ClientSecret(clientSecret).Token(token).Execute()
Revoke OAuth 2.0 Access or Refresh Token

Expand All @@ -1681,11 +1681,13 @@ import (
)

func main() {
clientId := "clientId_example" // string |
clientSecret := "clientSecret_example" // string |
token := "token_example" // string |

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.OAuth2Api.RevokeOAuth2Token(context.Background()).Token(token).Execute()
resp, r, err := apiClient.OAuth2Api.RevokeOAuth2Token(context.Background()).ClientId(clientId).ClientSecret(clientSecret).Token(token).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RevokeOAuth2Token``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
Expand All @@ -1704,6 +1706,8 @@ Other parameters are passed through a pointer to a apiRevokeOAuth2TokenRequest s

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**clientId** | **string** | |
**clientSecret** | **string** | |
**token** | **string** | |

### Return type
Expand Down
6 changes: 6 additions & 0 deletions oauth2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,12 @@ type revokeOAuth2Token struct {
// in: formData
// required: true
Token string `json:"token"`
// in: formData
// required: true
ClientID string `json:"client_id"`
// in: formData
// required: true
ClientSecret string `json:"client_secret"`
}

// swagger:route POST /oauth2/revoke oAuth2 revokeOAuth2Token
Expand Down
18 changes: 17 additions & 1 deletion spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -3419,6 +3419,20 @@
"application/x-www-form-urlencoded": {
"schema": {
"properties": {
"client_id": {
"required": [
"client_id"
],
"type": "string",
"x-formData-name": "client_id"
},
"client_secret": {
"required": [
"client_secret"
],
"type": "string",
"x-formData-name": "client_secret"
},
"token": {
"required": [
"token"
Expand All @@ -3428,7 +3442,9 @@
}
},
"required": [
"token"
"token",
"client_id",
"client_secret"
],
"type": "object"
}
Expand Down
12 changes: 12 additions & 0 deletions spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,18 @@
"name": "token",
"in": "formData",
"required": true
},
{
"type": "string",
"name": "client_id",
"in": "formData",
"required": true
},
{
"type": "string",
"name": "client_secret",
"in": "formData",
"required": true
}
],
"responses": {
Expand Down

0 comments on commit 367154d

Please sign in to comment.