This is kind of an old post but I recently ran into the error too and found the link to the docs to solve this. In case anyone in future needs to fix this issue, here is the link: https://github.com/googleworkspace/apps-script-oauth2/blob/main/samples/Basecamp.gs