Generate auth code and store to database
Use test security policy so authenticated_userid will work.