Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
remove client_credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Chadiii committed Apr 26, 2024
1 parent 0cc0766 commit 31a7ba3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 0 additions & 2 deletions utils/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,3 @@ func DefaultGlobalCodeWorkingDir() string {
const FEATURE_EXPERIMENTATION = "fe"
const WEB_EXPERIMENTATION = "we"
const HOME_CLI = ".cli"
const CLIENT_ID = "590_397jchm4asqo04g0ogcggcoo88wo44sg0c0owk0448gkwck8s8"
const CLIENT_SECRET = "5xc41rk3etwc404o8scs0s8c0sogcgc48g4sk0ggc44so4w00c"
14 changes: 11 additions & 3 deletions utils/http_request/common/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,27 @@ func Init(credL RequestConfig) {

func regenerateToken(product, configName string) {
var authenticationResponse models.TokenResponse
var err error

if product == utils.FEATURE_EXPERIMENTATION {
authenticationResponse, _ = HTTPRefreshTokenFE(cred.ClientID, cred.RefreshToken)
authenticationResponse, err = HTTPRefreshTokenFE(cred.ClientID, cred.RefreshToken)
if err != nil {
log.Fatalf("error occurred: %v", err)
}
} else {
authenticationResponse, _ = HTTPRefreshTokenWE(utils.CLIENT_ID, utils.CLIENT_SECRET, cred.RefreshToken)
authenticationResponse, err = HTTPCreateTokenWE(cred.ClientID, cred.ClientSecret, cred.AccountID)
if err != nil {
log.Fatalf("error occurred: %v", err)
}
}

if authenticationResponse.AccessToken == "" {
log.Fatal("client_id or client_secret not valid")
}

cred.RefreshToken = authenticationResponse.RefreshToken
cred.Token = authenticationResponse.AccessToken
err := config.WriteToken(product, configName, authenticationResponse)
err = config.WriteToken(product, configName, authenticationResponse)
if err != nil {
log.Fatalf("error occurred: %v", err)
}
Expand Down

0 comments on commit 31a7ba3

Please sign in to comment.