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

Method AuthMethods

codersdk/users.go:1076–1089  ·  view source on GitHub ↗

AuthMethods returns types of authentication available to the user.

(ctx context.Context)

Source from the content-addressed store, hash-verified

1074
1075// AuthMethods returns types of authentication available to the user.
1076func (c *Client) AuthMethods(ctx context.Context) (AuthMethods, error) {
1077 res, err := c.Request(ctx, http.MethodGet, "/api/v2/users/authmethods", nil)
1078 if err != nil {
1079 return AuthMethods{}, err
1080 }
1081 defer res.Body.Close()
1082
1083 if res.StatusCode != http.StatusOK {
1084 return AuthMethods{}, ReadBodyAsError(res)
1085 }
1086
1087 var userAuth AuthMethods
1088 return userAuth, json.NewDecoder(res.Body).Decode(&userAuth)
1089}

Callers 2

TestServerFunction · 0.95
TestUserAuthMethodsFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestServerFunction · 0.76
TestUserAuthMethodsFunction · 0.64