When trying to connect to SharePoint, the ShareGate migration tool displays the following error:
You are not authorized to connect to the SharePoint site. Make sure you have entered the correct user name and password.
Any error code ending with: -158
While the most common reason for this error is a mistake in username and password, there could be other reasons for the connection failure.
When the connection fails between the migration tool and your environment, the migration tool does not receive precise information from SharePoint or Microsoft 365 about the error.
The migration tool cannot provide a precise cause.
If your username and password are correct, you can validate other potential causes to find a solution.
We have comprehensive articles to help you with this error in our Troubleshoot Connection Issues section.
In the troubleshooting articles, you will find basic and advanced troubleshooting suggestions and everything you need to open a support ticket when all else fails.