Skip to content

Commit 5537f2a

Browse files
fix(oauth): inject public OAuth defaults (#216)
1 parent e7f6a9e commit 5537f2a

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

api/dashboard/client.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ import (
1111
"strings"
1212
)
1313

14-
// DefaultDashboardURL and DefaultAPIURL are empty by default and must be
15-
// injected at build time via ldflags, e.g.:
16-
//
17-
// go build -ldflags "-X github.com/algolia/cli/api/dashboard.DefaultDashboardURL=https://..."
18-
//
19-
// They can also be overridden at runtime with ALGOLIA_DASHBOARD_URL / ALGOLIA_API_URL / ALGOLIA_OAUTH_SCOPE
20-
// environment variables.
14+
// Production defaults; overridable via ldflags or ALGOLIA_DASHBOARD_URL / ALGOLIA_API_URL / ALGOLIA_OAUTH_SCOPE env vars.
2115
var (
22-
DefaultDashboardURL = ""
23-
DefaultAPIURL = ""
24-
DefaultOAuthScope = ""
16+
DefaultDashboardURL = "https://dashboard.algolia.com"
17+
DefaultAPIURL = "https://api.dashboard.algolia.com"
18+
DefaultOAuthScope = "public applications:manage keys:manage"
2519
)
2620

2721
// Client interacts with the Algolia Dashboard OAuth endpoint and the Public API.

pkg/auth/oauth_flow.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import (
1010
"github.com/algolia/cli/pkg/iostreams"
1111
)
1212

13-
// DefaultOAuthClientID is injected at build time via ldflags.
14-
// Override with ALGOLIA_OAUTH_CLIENT_ID environment variable for local development.
15-
var DefaultOAuthClientID = ""
13+
// DefaultOAuthClientID is a public OAuth client ID (PKCE flow, not a secret).
14+
var DefaultOAuthClientID = "-6xbCNF7usNqkcacFHKt0WHCJIZ2rlp2bP2_VH12xQE"
1615

1716
// OAuthClientID returns the OAuth client ID, preferring the ALGOLIA_OAUTH_CLIENT_ID
1817
// environment variable over the compiled-in default (set via ldflags).

0 commit comments

Comments
 (0)