diff --git a/backend/internal/api/handlers.go b/backend/internal/api/handlers.go index 901be5a..c3baf0e 100644 --- a/backend/internal/api/handlers.go +++ b/backend/internal/api/handlers.go @@ -390,7 +390,7 @@ func (h *ApiHandler) HandleGoogleCallback(w http.ResponseWriter, r *http.Request SameSite: parseSameSite(h.cfg.JWT.CookieSameSite), }) - redirectURL := "/dashboard" + redirectURL := fmt.Sprintf("%s/oauth/callback#access_token=%s", h.cfg.Frontend.Url, url.QueryEscape(token)) h.logger.InfoContext(ctx, "Google OAuth login successful", "userId", user.ID, "email", user.Email, "redirectingTo", redirectURL) http.Redirect(w, r, redirectURL, http.StatusTemporaryRedirect) } diff --git a/backend/internal/auth/oauth.go b/backend/internal/auth/oauth.go index abbacef..4c966b7 100644 --- a/backend/internal/auth/oauth.go +++ b/backend/internal/auth/oauth.go @@ -14,14 +14,11 @@ import ( // GoogleUserInfo holds user details fetched from Google. type GoogleUserInfo struct { - ID string `json:"id"` // The unique Google ID - Email string `json:"email"` // The user's email address - VerifiedEmail bool `json:"verified_email"` // Whether Google has verified the email - Name string `json:"name"` // User's full name - GivenName string `json:"given_name"` // First name - FamilyName string `json:"family_name"` // Last name - Picture string `json:"picture"` // URL to profile picture - Locale string `json:"locale"` // User's locale (e.g., "en") + ID string `json:"sub"` + Email string `json:"email"` + VerifiedEmail bool `json:"email_verified"` + Name string `json:"name"` + Picture string `json:"picture"` } // OAuthProvider defines the interface for OAuth operations. diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go index ead765e..72affa6 100644 --- a/backend/internal/config/config.go +++ b/backend/internal/config/config.go @@ -16,6 +16,7 @@ type Config struct { OAuth OAuthConfig Cache CacheConfig Storage StorageConfig + Frontend FrontendConfig } type ServerConfig struct { @@ -37,9 +38,9 @@ type LocalStorageConfig struct { } type GCSStorageConfig struct { - BucketName string `mapstructure:"bucketName"` - CredentialsFile string `mapstructure:"credentialsFile"` - BaseDir string `mapstructure:"baseDir"` + BucketName string `mapstructure:"bucketName"` + CredentialsFile string `mapstructure:"credentialsFile"` + BaseDir string `mapstructure:"baseDir"` } type DatabaseConfig struct { @@ -79,6 +80,10 @@ type CacheConfig struct { CleanupInterval time.Duration `mapstructure:"cleanupInterval"` } +type FrontendConfig struct { + Url string `mapstructure:"url"` +} + func LoadConfig(path string) (*Config, error) { viper.SetConfigName("config") // name of config file (without extension) viper.SetConfigType("yaml") // or viper.SetConfigType("YAML") @@ -103,6 +108,7 @@ func LoadConfig(path string) (*Config, error) { viper.SetDefault("cache.cleanupInterval", 10*time.Minute) viper.SetDefault("storage.type", "local") // Default to local storage viper.SetDefault("storage.local.path", "./uploads") + viper.SetDefault("frontend.url", "http://localhost:3000") err := viper.ReadInConfig() if err != nil { diff --git a/frontend/app/login/page.tsx b/frontend/app/login/page.tsx index 635d670..5d6fdac 100644 --- a/frontend/app/login/page.tsx +++ b/frontend/app/login/page.tsx @@ -199,15 +199,17 @@ export default function LoginPage() { Or continue with -
-