PostOAuth2ClientRegistration dynamically registers a new OAuth2 client (RFC 7591)
(ctx context.Context, req OAuth2ClientRegistrationRequest)
| 561 | |
| 562 | // PostOAuth2ClientRegistration dynamically registers a new OAuth2 client (RFC 7591) |
| 563 | func (c *Client) PostOAuth2ClientRegistration(ctx context.Context, req OAuth2ClientRegistrationRequest) (OAuth2ClientRegistrationResponse, error) { |
| 564 | res, err := c.Request(ctx, http.MethodPost, "/oauth2/register", req) |
| 565 | if err != nil { |
| 566 | return OAuth2ClientRegistrationResponse{}, err |
| 567 | } |
| 568 | defer res.Body.Close() |
| 569 | if res.StatusCode != http.StatusCreated { |
| 570 | return OAuth2ClientRegistrationResponse{}, ReadBodyAsError(res) |
| 571 | } |
| 572 | var resp OAuth2ClientRegistrationResponse |
| 573 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 574 | } |
| 575 | |
| 576 | // GetOAuth2ClientConfiguration retrieves client configuration (RFC 7592) |
| 577 | func (c *Client) GetOAuth2ClientConfiguration(ctx context.Context, clientID string, registrationAccessToken string) (OAuth2ClientConfiguration, error) { |