Created logic to get an access token