value of 'kid' has invalid format

Found the solution to this for me. When you send the token to your service, you send it with the following header

jwtTokenString: [auth token]

so don’t send it has a bearer token. Also, make sure you following the steps in the link provided by the Manny above https://docs.mongodb.com/realm/authentication/custom-jwt/