Supabase Unexpected error during login/signup

Open
#316 2 comments 0 reactions 1 assignee View on GitHub

@Tr00d is already working on this.

Since Aug 4, 2026.

Assessment

This issue has not been assessed yet.

Description

area: gotrue bug

6/5/2025 1:41:48 AM ==> ❌ Supabase Unexpected error during login/signup: Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type Supabase.Gotrue.Session. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'access_token', line 1, position 16.

this error is for this code on the android device:

public async Task SignInOrSignUpWithDeviceId()
    {
        string deviceId = OmUtility.GetDeviceId();
        string fakeEmail = $"{deviceId}@emperor.local";
        string password = deviceId;

        try
        {
       
            var session = await SupabaseManager.Instance.SupabaseClient.Auth.SignInWithPassword(fakeEmail, password);
            OmUtility.Log("Supabase User ID: " + session.User.Id);

            OmUtility.Log("✅ Supabase Device login successful");

            var sd = await LoadUserGameData();
            var loadedData = JsonUtility.FromJson<MainSaveManager.SaData>(sd.JsonData1);
            OmUtility.Log("Load Data Supabase , saveData1 : " + loadedData.saveData1);
        }
        catch (GotrueException ex)
        {
            if (ex.Message.Contains("Invalid login credentials") || ex.Message.Contains("user_not_found"))
            {
                OmUtility.Log("🆕 Supabase User not found. Trying signup...");

                try
                {
                    // var session = await SupabaseManager.Instance.SupabaseClient.Auth.SignUp(fakeEmail, password);
                    var session = await SupabaseManager.Instance.SupabaseClient.Auth.SignUp(fakeEmail, password);
                    OmUtility.Log("User ID: " + session.User.Id);

                    var sd = await LoadUserGameData();
                    var loadedData = JsonUtility.FromJson<MainSaveManager.SaData>(sd.JsonData1);
                    OmUtility.Log("Load Data Supabase , saveData1 : " + loadedData.saveData1);
                }
                catch (Exception signUpEx)
                {
                    OmUtility.Log("❌ Supabase Signup failed: " + signUpEx);
                }
            }
            else
            {
                OmUtility.Log("❌ Supabase Login failed with unknown error: " + ex.Message);
            }
        }
        catch (Exception ex)
        {
            OmUtility.Log("❌ Supabase Unexpected error during login/signup: " + ex);
        }
    }
Dominant language
C#
Stars
701
Forks
106
Avg merge
16h 35m
Merged PRs (30d)
45

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/supabase-csharp

All issues in supabase/supabase-csharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.