Skip to content

Commit 64455be

Browse files
committed
Make OAuth URLs more consistent
1 parent 72cbba5 commit 64455be

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

backend/web/api/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Handler(
3434

3535
mux := http.NewServeMux()
3636
mux.Handle("GET /articles", HandleArticleList(qry))
37-
mux.Handle("GET /github/signin", HandleOAuthSignin(&githubConf))
38-
mux.Handle("GET /google/signin", HandleOAuthSignin(&googleConf))
37+
mux.Handle("GET /signin/github", HandleOAuthSignin(&githubConf))
38+
mux.Handle("GET /signin/google", HandleOAuthSignin(&googleConf))
3939
return mux
4040
}

backend/web/handler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ func Handler(
100100
// Check if the debug auth method should be enabled.
101101
enableDebugAuth := os.Getenv("ENABLE_DEBUG_AUTH") != ""
102102
if enableDebugAuth {
103-
mux.Handle("POST /debug/signin", HandleDebugSignIn(conf.SecretKey, cmd))
103+
mux.Handle("POST /signin/debug", HandleDebugSignIn(conf.SecretKey, cmd))
104104
}
105105

106106
// Authenication routes.
107107
mux.Handle("GET /signin", HandleSignIn(enableDebugAuth))
108-
mux.Handle("GET /github/signin", HandleOAuthSignIn(&githubConf))
109-
mux.Handle("GET /github/callback", HandleOAuthCallback(conf.SecretKey, cmd, &githubConf, FetchGithubUserID))
110-
mux.Handle("GET /google/signin", HandleOAuthSignIn(&googleConf))
111-
mux.Handle("GET /google/callback", HandleOAuthCallback(conf.SecretKey, cmd, &googleConf, FetchGoogleUserID))
108+
mux.Handle("GET /signin/github", HandleOAuthSignIn(&githubConf))
109+
mux.Handle("GET /signin/github/callback", HandleOAuthCallback(conf.SecretKey, cmd, &githubConf, FetchGithubUserID))
110+
mux.Handle("GET /signin/google", HandleOAuthSignIn(&googleConf))
111+
mux.Handle("GET /signin/google/callback", HandleOAuthCallback(conf.SecretKey, cmd, &googleConf, FetchGoogleUserID))
112112
mux.Handle("POST /signout", HandleSignOutForm(cmd))
113113

114114
// Public blog routes.

backend/web/page/signin.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h2 class="signin__heading">Welcome!</h2>
77
<hr />
88

99
{{if .EnableDebugAuth}}
10-
<form method="POST" action="/debug/signin">
10+
<form method="POST" action="/signin/debug">
1111
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}" />
1212
<button class="signin__button" type="submit">
1313
<img class="signin__icon" src="/img/bloggulus.png" />
@@ -16,12 +16,12 @@ <h2 class="signin__heading">Welcome!</h2>
1616
</form>
1717
{{end}}
1818

19-
<a class="signin__button" href="/github/signin">
19+
<a class="signin__button" href="/signin/github">
2020
<img class="signin__icon" src="/img/github.png" />
2121
Sign in with GitHub
2222
</a>
2323

24-
<a class="signin__button" href="/google/signin">
24+
<a class="signin__button" href="/signin/google">
2525
<img class="signin__icon" src="/img/google.png" />
2626
Sign in with Google
2727
</a>

0 commit comments

Comments
 (0)