Getting an error when trying to add a HTTP default request header

I am attempting to save a authorization token to the HTTP header so that the rest of the site can use that token to access the database

I have tested the token and the Get in postman so i know it works. i am still not 100% if this is the right way to put the token in the header but its what i found.

login.razor

@page "/"
@inject HttpClient Http

<h1>Hello, world!</h1>

Welcome To The New Site

<EditForm Model="@user" OnValidSubmit="@HandleValidSubmit" OnInvalidSubmit="@HandleInvalidSubmit" Context="EditFormContext">
    <DataAnnotationsValidator />
    <DxFormLayout>
        <DxFormLayoutItem Caption="Username:" ColSpanMd="6">
            <Template>
                <DxTextBox @bind-Text="@user.username" />
            </Template>
        </DxFormLayoutItem>
        <DxFormLayoutItem Caption="Password:" ColSpanMd="6">
            <Template>
                <DxTextBox @bind-Text="@user.password" />
            </Template>
        </DxFormLayoutItem>
        <DxFormLayoutItem ColSpanMd="12">
            <Template>
                <ValidationSummary />
            </Template>
        </DxFormLayoutItem>
        <DxFormLayoutItem ColSpanMd="12">
            <Template>
                <button type="submit">Submit</button>
            </Template>
        </DxFormLayoutItem>
    </DxFormLayout>
</EditForm>

@code {
        User[] token;
        User user = new User();

        async void HandleValidSubmit()
        {
            Http.DefaultRequestHeaders.Remove("Authorization");
            token = await Http.GetJsonAsync<User[]>("http://testapi.com/api/token/" + user.username + "/" + user.password);
            string Token;
            Token = token[0].ToString();

            if (Token != null)
            {
                Http.DefaultRequestHeaders.Add("Authorization",String.Format("Bearer {0} ",Token));
                Console.WriteLine("OnValidSubmit");
            }
            else
            {
                Console.WriteLine("OnNOTValidSubmit");
            }
        }

        async void HandleInvalidSubmit()
        {}

    class User
    {
        public string username { get; set; }
        public string password { get; set; }
    }
}
Error: System.Text.Json.JsonException: 'e' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
 ---> System.Text.Json.JsonReaderException: 'e' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, JsonReaderException ex)
   at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
   at System.Text.Json.JsonSerializer.ReadCore(Type returnType, JsonSerializerOptions options, Utf8JsonReader& reader)
   at System.Text.Json.JsonSerializer.ParseCore(String json, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at Microsoft.AspNetCore.Components.HttpClientJsonExtensions.GetJsonAsync[T](HttpClient httpClient, String requestUri)
   at Websitewithpopup.Pages.Index.HandleValidSubmit() in C:\Users\GSacco\Documents\testsite\WebsitewithpopupDemoHP\Websitewithpopup\Pages\Index.razor:line 41
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)