Add dirname to filepaths, exit on invalid access token using HTTP