From 56ff77501da59d43fccb3ac24de582a3acd20dfa Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Tue, 9 Apr 2024 13:58:45 +0200 Subject: [PATCH] Remove unnecessary --- httpclient/oauth_token.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/httpclient/oauth_token.go b/httpclient/oauth_token.go index 6296c24e4..af3ad4115 100644 --- a/httpclient/oauth_token.go +++ b/httpclient/oauth_token.go @@ -3,25 +3,17 @@ package httpclient import ( "context" "net/http" - "net/url" "github.com/databricks/databricks-sdk-go/credentials" "golang.org/x/oauth2" ) -type authorizationDetails string - -func (r authorizationDetails) EncodeValues(key string, v *url.Values) error { - v.Set(key, string(r)) - return nil -} - type GetOAuthTokenRequest struct { - GrantType string `url:"grant_type"` - AuthorizationDetails authorizationDetails `url:"authorization_details"` - Assertion string `url:"assertion"` - ExpiresIn int `url:"expires_in,omitempty"` - RefreshToken bool `url:"refresh_token,omitempty"` + GrantType string `url:"grant_type"` + AuthorizationDetails string `url:"authorization_details"` + Assertion string `url:"assertion"` + ExpiresIn int `url:"expires_in,omitempty"` + RefreshToken bool `url:"refresh_token,omitempty"` } // Returns a new OAuth token using the provided token. The token must be a JWT token. @@ -36,7 +28,7 @@ func (c *ApiClient) GetOAuthToken(authDetails string, token *oauth2.Token) (*cre } data := GetOAuthTokenRequest{ GrantType: "urn:ietf:params:oauth:grant-type:jwt-bearer", - AuthorizationDetails: authorizationDetails(authDetails), + AuthorizationDetails: authDetails, Assertion: token.AccessToken, // By default, the tokens API does not refresh the token, so you can get a token that is about to expire. // We keep a cache of the Tokens, and only request when a new one is needed