Skip to content

Commit

Permalink
fix: restore ability to override auth and token urls for exemplary app (
Browse files Browse the repository at this point in the history
  • Loading branch information
dpeckett authored Aug 3, 2023
1 parent 0072ddf commit dfb129a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmd/cmd_perform_authorization_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ and success, unless if the --no-shutdown flag is provided.`,
prompt := flagx.MustGetStringSlice(cmd, "prompt")
maxAge := flagx.MustGetInt(cmd, "max-age")
redirectUrl := flagx.MustGetString(cmd, "redirect")
authUrl := flagx.MustGetString(cmd, "auth-url")
tokenUrl := flagx.MustGetString(cmd, "token-url")
audience := flagx.MustGetStringSlice(cmd, "audience")
noShutdown := flagx.MustGetBool(cmd, "no-shutdown")

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

if err != nil {
return err
if authUrl == "" {
authUrl = urlx.AppendPaths(endpoint, "/oauth2/auth").String()
}

if tokenUrl == "" {
tokenUrl = urlx.AppendPaths(endpoint, "/oauth2/token").String()
}

conf := oauth2.Config{
ClientID: clientID,
ClientSecret: clientSecret,
Endpoint: oauth2.Endpoint{
TokenURL: urlx.AppendPaths(endpoint, "/oauth2/token").String(),
AuthURL: urlx.AppendPaths(endpoint, "/oauth2/auth").String(),
AuthURL: authUrl,
TokenURL: tokenUrl,
},
RedirectURL: redirectUrl,
Scopes: scopes,
Expand Down

0 comments on commit dfb129a

Please sign in to comment.