Hi @Fahad Khan,
Thank you for posting in this community.
Based on the description of your question, it seems that you are using SharePoint API. But I am not quite sure whether you are using SharePoint Rest API or SharePoint Graph API. as these are not the same APIs, could you also please let me know.
For your first question:
SharePoint Framework solutions is managed in API access page, please make sure that you are adding SharePoint Framework solutions and not SharePoint Add-ins. If you are adding the correct object, I would suggest to re-add it again here by following the steps in this article.
Manage apps using the Apps site.
For your second question:
Here are some steps you can take to troubleshoot and resolve this error:
- Verify Permissions: Ensure that the user account you’re using has the necessary permissions to access the resource. You might need to check with your SharePoint administrator to confirm the required permissions.
- Check Authentication Tokens: SharePoint Online uses security tokens to authenticate users. If your tokens have expired or are invalid, you will receive this error. Try refreshing your tokens or obtaining new ones.
- Correct Site Context: Make sure you are using the correct URL for the SharePoint site where the resource is located. Double-check the URL in your API request.
- Form Digest Value: Ensure that you are including a valid form digest value in your request headers. This value is necessary for making authenticated requests to SharePoint.
- Network and Firewall Restrictions: Verify that there are no network or firewall restrictions blocking the communication between your application and the SharePoint server.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.