Found the solution!
When logging the variable I noticed it was number and not a string. I did not realize that it was probably a string before, so in order to try and fix the problem I had tried changing $user:string to $user:int.
Just after posting this I realized I did not actually try passing a string instead.
It is working like it should now