aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/auth/oauth.go3
-rw-r--r--backend/main.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/backend/auth/oauth.go b/backend/auth/oauth.go
index 012f339..b217ad2 100644
--- a/backend/auth/oauth.go
+++ b/backend/auth/oauth.go
@@ -95,7 +95,7 @@ func FetchOAuthMetadata(pdsURL string) (*OAuthMetadata, error) {
return &metadata, nil
}
-func BuildAuthorizationURL(metadata *OAuthMetadata, config *OAuthConfig, state, codeChallenge string) string {
+func BuildAuthorizationURL(metadata *OAuthMetadata, config *OAuthConfig, state, codeChallenge, handle string) string {
params := url.Values{
"response_type": {"code"},
"client_id": {config.ClientID},
@@ -104,6 +104,7 @@ func BuildAuthorizationURL(metadata *OAuthMetadata, config *OAuthConfig, state,
"code_challenge": {codeChallenge},
"code_challenge_method": {"S256"},
"scope": {"atproto"},
+ "login_hint": {handle},
}
return metadata.AuthorizationEndpoint + "?" + params.Encode()
diff --git a/backend/main.go b/backend/main.go
index cf87d0f..6598266 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -105,7 +105,7 @@ func loginHandler(w http.ResponseWriter, r *http.Request) {
}
challenge := auth.GenerateCodeChallenge(verifier)
- authURL := auth.BuildAuthorizationURL(metadata, &config, state, challenge)
+ authURL := auth.BuildAuthorizationURL(metadata, &config, state, challenge, handle)
// redirect user to PDS
http.Redirect(w, r, authURL, http.StatusFound)