MCPcopy Index your code
hub / github.com/coder/coder / ExternalAuthDeviceExchange

Method ExternalAuthDeviceExchange

codersdk/externalauth.go:150–160  ·  view source on GitHub ↗

ExchangeGitAuth exchanges a device code for an external auth token.

(ctx context.Context, provider string, req ExternalAuthDeviceExchange)

Source from the content-addressed store, hash-verified

148
149// ExchangeGitAuth exchanges a device code for an external auth token.
150func (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.
163func (c *Client) ExternalAuthByID(ctx context.Context, provider string) (ExternalAuth, error) {

Callers 2

TestExternalAuthDeviceFunction · 0.80
DeviceLoginMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1

TestExternalAuthDeviceFunction · 0.64