feat: serve latha-auth atproto OAuth client metadata
Build and Push Image / build (push) Successful in 40s

Add GET /oauth/atproto-client-metadata.json next to the existing OAuth
relay routes so AT Protocol authorization servers can resolve the
latha-auth public client (client_id is this URL).
This commit is contained in:
nandi committed 2026-11-18 06:20:41 +00:00
1 parent 4a9ec8b2ad
commit 6f3cb6777b
3 files changed
+70

No files matched your search

+28
View File
@@ -64,6 +64,34 @@ func (o *oauthRelayStore) pruneLocked(now time.Time) {
}
}
// atprotoClientMetadata is the OAuth Client ID Metadata Document for
// the latha-auth AT Protocol public client. It must stay available at
// exactly the client_id URL for the life of any session issued against
// it. Source of truth: `latha-auth atproto --print-client-metadata`.
var atprotoClientMetadata = struct {
ClientID string `json:"client_id"`
ClientName string `json:"client_name"`
GrantTypes []string `json:"grant_types"`
ResponseTypes []string `json:"response_types"`
RedirectURIs []string `json:"redirect_uris"`
Scope string `json:"scope"`
TokenEndpointAuthMethod string `json:"token_endpoint_auth_method"`
DPoPBoundAccessTokens bool `json:"dpop_bound_access_tokens"`
}{
ClientID: "https://deploy.site.latha.org/oauth/atproto-client-metadata.json",
ClientName: "latha-auth",
GrantTypes: []string{"authorization_code", "refresh_token"},
ResponseTypes: []string{"code"},
RedirectURIs: []string{"https://deploy.site.latha.org/oauth/callback"},
Scope: "atproto transition:generic",
TokenEndpointAuthMethod: "none",
DPoPBoundAccessTokens: true,
}
func (s *Server) handleAtprotoClientMetadata(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, atprotoClientMetadata)
}
func (s *Server) handleOAuthCallback(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
if errParam := q.Get("error"); errParam != "" {