Skip to content

Commit

Permalink
Chore: Moved universalAuthLogin function to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Apr 5, 2024
1 parent ba1f8f4 commit 1362922
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions cli/packages/cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func (tm *AgentManager) FetchNewAccessToken() error {
// save as cache in memory
tm.cachedClientSecret = clientSecret

err, loginResponse := universalAuthLogin(clientID, clientSecret)
loginResponse, err := util.UniversalAuthLogin(clientID, clientSecret)
if err != nil {
return err
}
Expand Down Expand Up @@ -725,20 +725,6 @@ func (tm *AgentManager) MonitorSecretChanges(secretTemplate Template, templateId
}
}

func universalAuthLogin(clientId string, clientSecret string) (error, api.UniversalAuthLoginResponse) {
httpClient := resty.New()
httpClient.SetRetryCount(10000).
SetRetryMaxWaitTime(20 * time.Second).
SetRetryWaitTime(5 * time.Second)

tokenResponse, err := api.CallUniversalAuthLogin(httpClient, api.UniversalAuthLoginRequest{ClientId: clientId, ClientSecret: clientSecret})
if err != nil {
return err, api.UniversalAuthLoginResponse{}
}

return nil, tokenResponse
}

// runCmd represents the run command
var agentCmd = &cobra.Command{
Example: `
Expand Down

0 comments on commit 1362922

Please sign in to comment.