Move gen_token into Auth class for more generic use