From 50dbf4d38ce669e1531430f3a1a930ef5e497b9e Mon Sep 17 00:00:00 2001 From: Tim B <45601014+tbalasavage@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:50:53 -0400 Subject: [PATCH] Use HCP token endpoint (#114) * Use HCP token endpoint * Update httpclient tests --- auth/auth.go | 2 +- config/new.go | 4 ++-- httpclient/httpclient_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/auth/auth.go b/auth/auth.go index fb225716..244100ce 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -9,7 +9,7 @@ import ( ) var ( - tokenPath string = "/oauth/token" + tokenPath string = "/oauth2/token" ) // WithClientCredentials returns an http client with an access token obtained using the configured client credentials. diff --git a/config/new.go b/config/new.go index dc91b6fd..d69300d7 100644 --- a/config/new.go +++ b/config/new.go @@ -14,7 +14,7 @@ import ( const ( // defaultAuthURL is the URL of the production auth endpoint. - defaultAuthURL = "https://auth.hashicorp.com" + defaultAuthURL = "https://auth.idp.hashicorp.com" // defaultPortalURL is the URL of the production portal. defaultPortalURL = "https://portal.cloud.hashicorp.com" @@ -31,7 +31,7 @@ const ( aud = "https://api.hashicorp.cloud" // tokenPath is the path used to retrieve the access token. - tokenPath string = "/oauth/token" + tokenPath string = "/oauth2/token" ) // NewHCPConfig will return a HCPConfig. The configuration will be constructed diff --git a/httpclient/httpclient_test.go b/httpclient/httpclient_test.go index 1c3e8b1d..3754f110 100644 --- a/httpclient/httpclient_test.go +++ b/httpclient/httpclient_test.go @@ -19,7 +19,7 @@ import ( func TestNew(t *testing.T) { - tokenPath := "/oauth/token" + tokenPath := "/oauth2/token" token := "90d64460d14870c08c81352a05dedd3465940a7c" clientID := "CLIENT_ID" clientSecret := "CLIENT_SECRET"