X Tutup
Skip to content

Commit 71d3696

Browse files
committed
Avoid redirecting to localhost during authorization flow
Web developers who have previously ran an application on `http://localhost` that enabled HSTS (HTTP Strict Transport Security) will find themselves unable to authenticate because their browser (typically Safari, in practice) will keep redirecting them to `https://localhost`, which isn't handled by our local server. This switches the authorization callback to be to `127.0.0.1`, which should be equivalent to `localhost`, but not subject to HSTS.
1 parent 8a4fd43 commit 71d3696

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

auth/oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (oa *OAuthFlow) ObtainAccessToken() (accessToken string, err error) {
4747

4848
q := url.Values{}
4949
q.Set("client_id", oa.ClientID)
50-
q.Set("redirect_uri", fmt.Sprintf("http://localhost:%d/callback", port))
50+
q.Set("redirect_uri", fmt.Sprintf("http://127.0.0.1:%d/callback", port))
5151
// TODO: make scopes configurable
5252
q.Set("scope", "repo")
5353
q.Set("state", state)

0 commit comments

Comments
 (0)
X Tutup