ExchangeGitAuth exchanges a device code for an external auth token.
(ctx context.Context, provider string, req ExternalAuthDeviceExchange)
| 148 | |
| 149 | // ExchangeGitAuth exchanges a device code for an external auth token. |
| 150 | func (c *Client) ExternalAuthDeviceExchange(ctx context.Context, provider string, req ExternalAuthDeviceExchange) error { |
| 151 | res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/external-auth/%s/device", provider), req) |
| 152 | if err != nil { |
| 153 | return err |
| 154 | } |
| 155 | defer res.Body.Close() |
| 156 | if res.StatusCode != http.StatusNoContent { |
| 157 | return ReadBodyAsError(res) |
| 158 | } |
| 159 | return nil |
| 160 | } |
| 161 | |
| 162 | // ExternalAuthByID returns the external auth for the given provider by ID. |
| 163 | func (c *Client) ExternalAuthByID(ctx context.Context, provider string) (ExternalAuth, error) { |