Question I've posted it and will give it a bounty in 2 days.

@mistersql

Self-replies

The problem was the API client can't deal with accounts with 2 factor auth enabled and the error message "invalid_grant" isn't exactly suggestive of what the problem really is.