Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Fix refresh access token request body (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
genzj authored Feb 2, 2022
1 parent 12dfd3c commit 6353813
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ type Client struct {
HTTPClient http.Client `json:"-"`
}

const (
clientID = "9B0Gi617tROKHc2rS95sT1yJzR6MkQDm"
clientSecret = "oSJOB1KOWnLVZm11DVknu2wZkTj5AGKxcINEDtEUPE30jHKvEqorM8ocWbyo17Hd" // nolint:gosec
)

var ErrorUnexpectedStatusCode = errors.New("unexpected status code")

func Login(username string, password string) (*Client, error) {
Expand All @@ -60,8 +65,8 @@ func Login(username string, password string) (*Client, error) {
"username": username,
"password": password,
"scope": "openid offline_access nas_read_write nas_read_only user_read device_read",
"client_id": "9B0Gi617tROKHc2rS95sT1yJzR6MkQDm",
"client_secret": "oSJOB1KOWnLVZm11DVknu2wZkTj5AGKxcINEDtEUPE30jHKvEqorM8ocWbyo17Hd",
"client_id": clientID,
"client_secret": clientSecret,
}

data, err := json.Marshal(req)
Expand Down Expand Up @@ -105,7 +110,8 @@ func osType() string {
func (c *Client) refreshAccessToken() error {
req := map[string]string{
"audience": "mycloud.com",
"client_id": c.Configuration.GetString("com.wd.portal", "portal.auth0.client"),
"client_id": clientID,
"client_secret": clientSecret,
"grant_type": "refresh_token",
"refresh_token": c.RefreshToken,
}
Expand Down

0 comments on commit 6353813

Please sign in to comment.