diff --git a/api_authentication.go b/api_authentication.go index 0dfe17a..b139b68 100644 --- a/api_authentication.go +++ b/api_authentication.go @@ -76,7 +76,11 @@ func (a *AuthenticationAPIService) AuthToken(ctx context.Context) ApiAuthTokenRe } } -func (r ApiAuthTokenRequest) AuthToken() (*OAuth, *http.Response, error) { +func (r ApiAuthTokenRequest) GetAuthToken(clientId string, clientSecret string) (*OAuth, *http.Response, error) { + r.clientId = new(string) + *r.clientId = clientId + r.clientSecret = new(string) + *r.clientSecret = clientSecret return r.Execute() } diff --git a/api_authentication_test.go b/api_authentication_test.go index cfb0c2f..e0d1973 100644 --- a/api_authentication_test.go +++ b/api_authentication_test.go @@ -26,10 +26,8 @@ func Test_TelstraMessaging_AuthenticationAPIService(t *testing.T) { clientSecret := "YOUR CLIENT SECRET" authApi := apiClient.AuthenticationAPI.AuthToken(context.Background()) - authApi.clientId = &clientId - authApi.clientSecret = &clientSecret - oauthResult, resp, err := authApi.AuthToken() + oauthResult, resp, err := authApi.GetAuthToken(clientId, clientSecret) if err != nil { fmt.Println("Error:", err) diff --git a/api_params.go b/api_params.go index 16713c5..6b70d69 100644 --- a/api_params.go +++ b/api_params.go @@ -31,10 +31,7 @@ func SetRequestParams() *RequestParams { func GetAuthorization(apiClient *APIClient, clientId string, clientSecret string) (string, error) { authApi := apiClient.AuthenticationAPI.AuthToken(context.Background()) - authApi.clientId = &clientId - authApi.clientSecret = &clientSecret - - oauthResult, _, err := authApi.AuthToken() + oauthResult, _, err := authApi.GetAuthToken(clientId, clientSecret) if err != nil { return "", err }