Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions oauth/authcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ func (ac *AuthorizationCodeTokenSource) Token() (*oauth2.Token, error) {
// AuthCodeHandler sets up the OAuth 2.0 authorization code with PKCE authentication
// flow.
type AuthCodeHandler struct {
ClientID string
AuthorizeURL string
TokenURL string
Keys []string
Params []string
Scopes []string
ClientID string
AuthorizeURL string
TokenURL string
Keys []string
Params []string
Scopes []string
DefaultValues map[string]string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to get initialized somewhere? If we rely on it to happen in someone's main then what happens if they forget?


getParamsFunc func(profile map[string]string) url.Values
}
Expand All @@ -156,7 +157,11 @@ func (h *AuthCodeHandler) OnRequest(log *zerolog.Logger, request *http.Request)
params = h.getParamsFunc(profile)
}
for _, name := range h.Params {
params.Add(name, profile[name])
if val, ok := profile[name]; ok {
params.Add(name, val)
} else {
params.Add(name, h.DefaultValues[name])
}
}

source := &AuthorizationCodeTokenSource{
Expand Down