@@ -679,6 +679,26 @@ func (c *Client) ConvertLoginType(ctx context.Context, req ConvertLoginRequest)
679
679
return resp ,nil
680
680
}
681
681
682
+ // ConvertUserLoginType will send a request to convert the user from password
683
+ // based authentication to oauth based. The response has the oauth state code
684
+ // to use in the oauth flow.
685
+ func (c * Client )ConvertUserLoginType (ctx context.Context ,user string ,req ConvertLoginRequest ) (OAuthConversionResponse ,error ) {
686
+ res ,err := c .Request (ctx ,http .MethodPost ,fmt .Sprintf ("/api/v2/users/%s/convert-login" ,user ),req )
687
+ if err != nil {
688
+ return OAuthConversionResponse {},err
689
+ }
690
+ defer res .Body .Close ()
691
+ if res .StatusCode != http .StatusCreated {
692
+ return OAuthConversionResponse {},ReadBodyAsError (res )
693
+ }
694
+ var resp OAuthConversionResponse
695
+ err = json .NewDecoder (res .Body ).Decode (& resp )
696
+ if err != nil {
697
+ return OAuthConversionResponse {},err
698
+ }
699
+ return resp ,nil
700
+ }
701
+
682
702
// Logout calls the /logout API
683
703
// Call `ClearSessionToken()` to clear the session token of the client.
684
704
func (c * Client )Logout (ctx context.Context )error {