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

Method ExternalAuthByID

codersdk/externalauth.go:163–174  ·  view source on GitHub ↗

ExternalAuthByID returns the external auth for the given provider by ID.

(ctx context.Context, provider string)

Source from the content-addressed store, hash-verified

161
162// ExternalAuthByID returns the external auth for the given provider by ID.
163func (c *Client) ExternalAuthByID(ctx context.Context, provider string) (ExternalAuth, error) {
164 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/external-auth/%s", provider), nil)
165 if err != nil {
166 return ExternalAuth{}, err
167 }
168 defer res.Body.Close()
169 if res.StatusCode != http.StatusOK {
170 return ExternalAuth{}, ReadBodyAsError(res)
171 }
172 var extAuth ExternalAuth
173 return extAuth, json.NewDecoder(res.Body).Decode(&extAuth)
174}
175
176// UnlinkExternalAuthByID deletes the external auth for the given provider by ID
177// for the user. This does not revoke the token from the IDP.

Callers 2

TestExternalAuthByIDFunction · 0.80
TestExternalAuthDeviceFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestExternalAuthByIDFunction · 0.64
TestExternalAuthDeviceFunction · 0.64