I'm facing an issue in uploading the files to sharepoint while I'm able to generate the token but while trying to upload the file it is throwing an error {"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedEx

Anonym 0 Reputation points

User's image

This I'm getting after trying to upload the file

User's image

I'm able to generate the token and I've given full control permission also.

I've followed this blog and this collection

Please help me sort this issue as soon as possible

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,273 questions
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,055 questions
SharePoint Workflow
SharePoint Workflow
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Workflow: An orchestrated and repeatable pattern of business activity, enabling data transformation, service provision, and information retrieval.
540 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 32,726 Reputation points Microsoft Vendor

    Hi @Anonym,

    You could put the accesstoken in request header and use the api like following

    http://test.sharepoint.com/sites/testsite/_api/web/GetFolderByServerRelativeUrl('/sites/testsite/library name')/Files/add(url='a.txt',overwrite=true)

    User's image

    For more detail steps you could refer to following artilce


    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.