PutOAuth2ClientConfiguration updates client configuration (RFC 7592)
(ctx context.Context, clientID string, registrationAccessToken string, req OAuth2ClientRegistrationRequest)
| 592 | |
| 593 | // PutOAuth2ClientConfiguration updates client configuration (RFC 7592) |
| 594 | func (c *Client) PutOAuth2ClientConfiguration(ctx context.Context, clientID string, registrationAccessToken string, req OAuth2ClientRegistrationRequest) (OAuth2ClientConfiguration, error) { |
| 595 | res, err := c.Request(ctx, http.MethodPut, fmt.Sprintf("/oauth2/clients/%s", clientID), req, |
| 596 | func(r *http.Request) { |
| 597 | r.Header.Set("Authorization", "Bearer "+registrationAccessToken) |
| 598 | }) |
| 599 | if err != nil { |
| 600 | return OAuth2ClientConfiguration{}, err |
| 601 | } |
| 602 | defer res.Body.Close() |
| 603 | if res.StatusCode != http.StatusOK { |
| 604 | return OAuth2ClientConfiguration{}, ReadBodyAsError(res) |
| 605 | } |
| 606 | var resp OAuth2ClientConfiguration |
| 607 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 608 | } |
| 609 | |
| 610 | // DeleteOAuth2ClientConfiguration deletes client registration (RFC 7592) |
| 611 | func (c *Client) DeleteOAuth2ClientConfiguration(ctx context.Context, clientID string, registrationAccessToken string) error { |