OAuth2ProviderApp returns an application configured to authenticate using Coder as an OAuth2 provider.
(ctx context.Context, id uuid.UUID)
| 62 | // OAuth2ProviderApp returns an application configured to authenticate using |
| 63 | // Coder as an OAuth2 provider. |
| 64 | func (c *Client) OAuth2ProviderApp(ctx context.Context, id uuid.UUID) (OAuth2ProviderApp, error) { |
| 65 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/oauth2-provider/apps/%s", id), nil) |
| 66 | if err != nil { |
| 67 | return OAuth2ProviderApp{}, err |
| 68 | } |
| 69 | defer res.Body.Close() |
| 70 | if res.StatusCode != http.StatusOK { |
| 71 | return OAuth2ProviderApp{}, ReadBodyAsError(res) |
| 72 | } |
| 73 | var apps OAuth2ProviderApp |
| 74 | return apps, json.NewDecoder(res.Body).Decode(&apps) |
| 75 | } |
| 76 | |
| 77 | type PostOAuth2ProviderAppRequest struct { |
| 78 | Name string `json:"name" validate:"required,oauth2_app_name"` |