update authenticate to scala