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

Method Logout

codersdk/users.go:973–982  ·  view source on GitHub ↗

Logout calls the /logout API Call `ClearSessionToken()` to clear the session token of the client.

(ctx context.Context)

Source from the content-addressed store, hash-verified

971// Logout calls the /logout API
972// Call `ClearSessionToken()` to clear the session token of the client.
973func (c *Client) Logout(ctx context.Context) error {
974 // Since `LoginWithPassword` doesn't actually set a SessionToken
975 // (it requires a call to SetSessionToken), this is essentially a no-op
976 res, err := c.Request(ctx, http.MethodPost, "/api/v2/users/logout", nil)
977 if err != nil {
978 return err
979 }
980 defer res.Body.Close()
981 return nil
982}
983
984// User returns a user for the ID/username provided.
985func (c *Client) User(ctx context.Context, userIdent string) (User, error) {

Callers 1

logoutMethod · 0.45

Calls 2

RequestMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected