separated get access token into its own function