handleGetClient returns public client info for the consent page.
(c *echo.Context)
| 81 | |
| 82 | // handleGetClient returns public client info for the consent page. |
| 83 | func (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 | |
| 103 | func generateClientID() (string, error) { |
| 104 | // Use 24 bytes for client ID (shorter than refresh tokens) |
nothing calls this directly
no test coverage detected