diff --git a/backend/internal/handler/auth_handler.go b/backend/internal/handler/auth_handler.go index 85792667..7f38a41c 100644 --- a/backend/internal/handler/auth_handler.go +++ b/backend/internal/handler/auth_handler.go @@ -473,6 +473,8 @@ func (h *AuthHandler) Signup(c *fiber.Ctx) error { normalizedPhone = "+" + normalizedPhone } + slog.Info("[Signup] Phone normalization", "raw", req.Phone, "normalized", normalizedPhone) + // IDP에 전달할 BrokerUser 스키마 구성 attributes := map[string]interface{}{ "department": req.Department, @@ -517,7 +519,8 @@ func (h *AuthHandler) Signup(c *fiber.Ctx) error { if strings.Contains(err.Error(), "already exists") { return errorJSON(c, fiber.StatusConflict, "User already exists") } - return errorJSON(c, fiber.StatusInternalServerError, "Failed to create user") + // Include the actual error message in the response for debugging + return errorJSON(c, fiber.StatusInternalServerError, fmt.Sprintf("Failed to create user: %v", err)) } // 4. Cleanup Redis diff --git a/backend/internal/repository/tenant_repository.go b/backend/internal/repository/tenant_repository.go index 9a18c4fe..6eed4e73 100644 --- a/backend/internal/repository/tenant_repository.go +++ b/backend/internal/repository/tenant_repository.go @@ -3,6 +3,7 @@ package repository import ( "baron-sso-backend/internal/domain" "context" + "strings" "gorm.io/gorm" ) @@ -45,7 +46,7 @@ func (r *tenantRepository) FindByID(ctx context.Context, id string) (*domain.Ten func (r *tenantRepository) FindBySlug(ctx context.Context, slug string) (*domain.Tenant, error) { var tenant domain.Tenant - if err := r.db.WithContext(ctx).Preload("Domains").Where("slug = ?", slug).First(&tenant).Error; err != nil { + if err := r.db.WithContext(ctx).Preload("Domains").Where("slug = ?", strings.ToLower(slug)).First(&tenant).Error; err != nil { return nil, err } return &tenant, nil