authentify and set auth cookies