GetOAuth2ClientConfiguration retrieves client configuration (RFC 7592)
(ctx context.Context, clientID string, registrationAccessToken string)
| 575 | |
| 576 | // GetOAuth2ClientConfiguration retrieves client configuration (RFC 7592) |
| 577 | func (c *Client) GetOAuth2ClientConfiguration(ctx context.Context, clientID string, registrationAccessToken string) (OAuth2ClientConfiguration, error) { |
| 578 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/oauth2/clients/%s", clientID), nil, |
| 579 | func(r *http.Request) { |
| 580 | r.Header.Set("Authorization", "Bearer "+registrationAccessToken) |
| 581 | }) |
| 582 | if err != nil { |
| 583 | return OAuth2ClientConfiguration{}, err |
| 584 | } |
| 585 | defer res.Body.Close() |
| 586 | if res.StatusCode != http.StatusOK { |
| 587 | return OAuth2ClientConfiguration{}, ReadBodyAsError(res) |
| 588 | } |
| 589 | var resp OAuth2ClientConfiguration |
| 590 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 591 | } |
| 592 | |
| 593 | // PutOAuth2ClientConfiguration updates client configuration (RFC 7592) |
| 594 | func (c *Client) PutOAuth2ClientConfiguration(ctx context.Context, clientID string, registrationAccessToken string, req OAuth2ClientRegistrationRequest) (OAuth2ClientConfiguration, error) { |