fix bug while fetching pictures
refactoring of authentication