codes refactoring for getAuthToken and getNotes