Session being overridden between requests?

Can you paste the output of what x inspect returns, replacing RestUrl with the URL your App is using:

$ x inspect {RestUrl}

Don’t need the table of routes, just the initial metadata.

Yeah:

private string RestUrl => ApiSettings.Instance.ApiHost;
"ConnectionStrings": {
    "apihost": "http://localhost:5051",
    "clientusername": "**********",
    "clientpassword": "**********",
  }

And it definitely hits EhrCredentialsAuthProvider :

x inspect seems to just get stuck and return nothing, I have to ctrl+c to break out.

This returns nothing?

$ x inspect http://localhost:5051

Yeah it’s just stuck here:

ok then can you go to http://localhost:5051/metadata/app.json and paste the plugins + auth section, e.g:

Oh I know why, it was stuck on the breakpoint… haha.

Here it is from x inspect:

ok then lets try authenticate directly with credentials auth using the x tool, can you replace the variable placeholders with what your app uses, e.g:

$ x send http://localhost:5051 Authenticate {provider:'credentials',username:'{ClientUserName}',password:'{ClientPassword}'}

Should I try this using the old connect() or the one you provided?

Nevermind it uses neither if it’s from command line right

try the command with the x tool to see if it works

The remote server returned an error: (404) NotFound.

I don’t understand, did you use the right URL?

I used this:
x send http://localhost:5051 Authenticate {provider:'credentials',username:'USERNAMEHERE',password:'PASSWORDHERE'}

That looks right, but don’t get why it’s not working. In that case can you paste the fiddler Request/Response Headers of the Authenticate Request the App does, scrubbing the User/Pass out

No Authenticate request shows up, it just errors out.

I changed provider = "credentials" to provider = "bysystem" and now the error is Invalid Username or Password

OK i get it now, the non-existent auth provider returns a 404 which is what the error message was referring to, not that the URL was invalid.

Does your custom AuthProvider replace Provider with bysystem (I asked this earlier), if it does remove it or you can leave it and change the client to use provider="bysystem" as you’re doing.

Yep it does replace provider with “bysystem”, I must have misunderstood when you asked.

Now it’s hitting TryAuthenticateAsync() but failing because that method is trying to validate a user’s username/password, not the app’s.

Change it to use what it should? It’s going to try authenticate with what ever you’ve told it to use.

As I’ve mentioned, I’m not the one who initially made all this.
So to understand correctly, TryAuthenticateAsync() is supposed to authenticate the client I’m sending from, not the user of the react app?

That’s up to your Custom Auth Provider, I can’t tell anything from here.