Skip to content

Commit 71a647b

Browse files
authored
feat: support ConvertUserLoginType for another user in codersdk(#17784)
Added `ConvertUserLoginType(ctx, user, req)` method to support converting the login type for a specified user.
1 parent d63417b commit 71a647b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

codersdk/users.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,14 @@ func (c *Client) ChangePasswordWithOneTimePasscode(ctx context.Context, req Chan
663663
// based authentication to oauth based. The response has the oauth state code
664664
// to use in the oauth flow.
665665
func (c *Client) ConvertLoginType(ctx context.Context, req ConvertLoginRequest) (OAuthConversionResponse, error) {
666-
res, err := c.Request(ctx, http.MethodPost, "/api/v2/users/me/convert-login", req)
666+
return c.ConvertUserLoginType(ctx, Me, req)
667+
}
668+
669+
// ConvertUserLoginType will send a request to convert the user from password
670+
// based authentication to oauth based. The response has the oauth state code
671+
// to use in the oauth flow.
672+
func (c *Client) ConvertUserLoginType(ctx context.Context, user string, req ConvertLoginRequest) (OAuthConversionResponse, error) {
673+
res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/users/%s/convert-login", user), req)
667674
if err != nil {
668675
return OAuthConversionResponse{}, err
669676
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy