This error occurs when Sharepoint API doesn’t have permission for Graph API.
I have encountered this error while adding recently used documents to one of my sharepoint site.
- Go to sharepoint admin center.
- Click on API access.
- Select the pending request and click on approve.
And you are done.
Now, I can add recently used documents in my sharepoint site.