Skip to content

Preserve custom avatar on Google OAuth login #45

@KaliCZ

Description

@KaliCZ

Problem

When a user uploads a custom avatar and later signs in with Google OAuth, Supabase overwrites user_metadata.avatar_url with the Google profile picture. The custom avatar is lost.

Proposed Fix

Store custom avatars in a separate metadata field (custom_avatar_url). Prefer it over the Google-provided avatar_url when displaying.

Frontend

  • Profile page: write uploaded avatar to custom_avatar_url instead of avatar_url
  • Layout.astro: read custom_avatar_url ?? avatar_url for display

Backend

  • HttpContextCurrentUserAccessor: check custom_avatar_url first, fall back to avatar_url
  • SupabaseUserInfoService: same precedence

Files involved

  • frontend/src/pages/[...lang]/profile.astro — avatar upload
  • frontend/src/layouts/Layout.astro — avatar display
  • backend/src/Kalandra.Api/Infrastructure/Auth/HttpContextCurrentUserAccessor.cs — JWT extraction
  • backend/src/Kalandra.Infrastructure/Users/SupabaseUserInfoService.cs — admin API fetch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions