made authentication possible through cookies when doing json request