MCPcopy Create free account
hub / github.com/bytebase/bytebase / handleGetClient

Method handleGetClient

backend/api/oauth2/oauth2.go:83–101  ·  view source on GitHub ↗

handleGetClient returns public client info for the consent page.

(c *echo.Context)

Source from the content-addressed store, hash-verified

81
82// handleGetClient returns public client info for the consent page.
83func (s *Service) handleGetClient(c *echo.Context) error {
84 ctx := c.Request().Context()
85 clientID := c.Param("clientID")
86
87 client, err := s.store.GetOAuth2Client(ctx, clientID)
88 if err != nil {
89 return oauth2Error(c, http.StatusInternalServerError, "server_error", "failed to lookup client")
90 }
91 if client == nil {
92 return oauth2Error(c, http.StatusNotFound, "invalid_client", "client not found")
93 }
94
95 // Return only public info (no secret)
96 return c.JSON(http.StatusOK, map[string]any{
97 "client_id": client.ClientID,
98 "client_name": client.Config.ClientName,
99 "redirect_uris": client.Config.RedirectUris,
100 })
101}
102
103func generateClientID() (string, error) {
104 // Use 24 bytes for client ID (shorter than refresh tokens)

Callers

nothing calls this directly

Calls 2

oauth2ErrorFunction · 0.85
GetOAuth2ClientMethod · 0.80

Tested by

no test coverage detected