Skip to content

Commit dfb129a

Browse files
authored
fix: restore ability to override auth and token urls for exemplary app (#3590)
1 parent 0072ddf commit dfb129a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cmd/cmd_perform_authorization_code.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ and success, unless if the --no-shutdown flag is provided.`,
9797
prompt := flagx.MustGetStringSlice(cmd, "prompt")
9898
maxAge := flagx.MustGetInt(cmd, "max-age")
9999
redirectUrl := flagx.MustGetString(cmd, "redirect")
100+
authUrl := flagx.MustGetString(cmd, "auth-url")
101+
tokenUrl := flagx.MustGetString(cmd, "token-url")
100102
audience := flagx.MustGetStringSlice(cmd, "audience")
101103
noShutdown := flagx.MustGetBool(cmd, "no-shutdown")
102104

@@ -118,15 +120,20 @@ and success, unless if the --no-shutdown flag is provided.`,
118120
redirectUrl = serverLocation + "callback"
119121
}
120122

121-
if err != nil {
122-
return err
123+
if authUrl == "" {
124+
authUrl = urlx.AppendPaths(endpoint, "/oauth2/auth").String()
123125
}
126+
127+
if tokenUrl == "" {
128+
tokenUrl = urlx.AppendPaths(endpoint, "/oauth2/token").String()
129+
}
130+
124131
conf := oauth2.Config{
125132
ClientID: clientID,
126133
ClientSecret: clientSecret,
127134
Endpoint: oauth2.Endpoint{
128-
TokenURL: urlx.AppendPaths(endpoint, "/oauth2/token").String(),
129-
AuthURL: urlx.AppendPaths(endpoint, "/oauth2/auth").String(),
135+
AuthURL: authUrl,
136+
TokenURL: tokenUrl,
130137
},
131138
RedirectURL: redirectUrl,
132139
Scopes: scopes,

0 commit comments

Comments
 (0)