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

Method ExternalAuthDeviceByID

codersdk/externalauth.go:136–147  ·  view source on GitHub ↗
(ctx context.Context, provider string)

Source from the content-addressed store, hash-verified

134}
135
136func (c *Client) ExternalAuthDeviceByID(ctx context.Context, provider string) (ExternalAuthDevice, error) {
137 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/external-auth/%s/device", provider), nil)
138 if err != nil {
139 return ExternalAuthDevice{}, err
140 }
141 defer res.Body.Close()
142 if res.StatusCode != http.StatusOK {
143 return ExternalAuthDevice{}, ReadBodyAsError(res)
144 }
145 var extAuth ExternalAuthDevice
146 return extAuth, json.NewDecoder(res.Body).Decode(&extAuth)
147}
148
149// ExchangeGitAuth exchanges a device code for an external auth token.
150func (c *Client) ExternalAuthDeviceExchange(ctx context.Context, provider string, req ExternalAuthDeviceExchange) 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