Error authenticating with Realm Custom JWT with manual signing keys

I am using an external api to create user accounts and then generate a HS256 jwt with jsonwebtoken on a nodejs server.

However when I pass the jwt which is a string to the realm flutter sdk with the code

final token =  Credentials.jwt(jwt);
User loggedInUser = app.login(token)

I get this weird error invalid custom auth token: valid UID required (between 1 and 128 characters)

I can’t find any help reading the docs. Let me know if there’s something I’m doing wrong