I encountered the same issue during the migration of Google to M365. Even all the prerequisites appear met, but when I looked at the parameters found two problems.
- Under Domain wide delegation section there were only four URLs authorized.
- Only Gmail API was enabled while we need Calander and Contacts enabled as well.
Here's the steps to fix that problem:
- Open the Domain Wide Delegation page and add the below URLs
https://www.googleapis.com/auth/gmail.settings.sharing https://www.google.com/m8/feeds https://www.googleapis.com/auth/contacts.readonly https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/admin.directory.group.readonly https://www.googleapis.com/auth/admin.directory.user.readonly https://sites.google.com/feeds/ https://www.googleapis.com/auth/gmail.settings.basic
- Use the below URL to enable the missing APIs https://console.developers.google.com/apis/library