rstudio server authentication

I have rstudio server configured to authenticate via active directory

the problem is when the home directory is not already created and is the first login
it doesnt create the home directory automatically and says "Could not connect to Rstudio server"

i already add
session required pam_unix.so
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022

on /etc/pam.d/system-auth

can you help?

The open source RStudio Server does not support PAM sessions. In the commercial RStudio Workbench you have to enable it manually via auth-pam-sessions-enabled=1 in rserver.conf in case you are using Launcher sessions.