Skip to content

Commit

Permalink
fix: use better url parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarrett-isp committed Dec 6, 2023
1 parent ac559b9 commit 9a25266
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions oauth/authcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,11 @@ func (ac *AuthorizationCodeTokenSource) Token() (*oauth2.Token, error) {
}

// strip protocol prefix from configured redirect url for local webserver
redirectServer := strings.TrimPrefix(ac.getRedirectUrl(), "https://")
redirectServer = strings.TrimPrefix(redirectServer, "http://")
u, err := url.Parse(ac.getRedirectUrl())
if err != nil {
panic(err)
}
redirectServer := fmt.Sprintf("%s:%s", u.Hostname(), u.Port())

s := &http.Server{
Addr: redirectServer,
Expand Down

0 comments on commit 9a25266

Please sign in to comment.