0

I am currently trying to start with Office365-REST-Python-Client for App only authentication. My goal is to end up posting a document to SharePoint, on my way to that, I found that I need the following permissions:

<AppPermissionRequests AllowAppOnlyPolicy="true">
 <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
 <AppPermissionRequest Scope="http://sharepoint/search" Right="QueryAsUserIgnoreAppPrincipal"/>
 <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="FullControl" />
 <AppPermissionRequest Scope="http://sharepoint/taxonomy" Right="FullControl" />

However due to the changes that microsoft made I am having a bit of trouble, navigating to https://{tenant}.sharepoint.com/sites/MySite/_layouts/15/appinv.aspx is fine and a I can carry on as normal, only when applying the permissions I will be faced with the message:

Your tenant administrator has to approve this app.

this can be solved by adding -admin after tenant like this: https://{tenant}-admin.sharepoint.com/sites/MySite/_layouts/15/appinv.aspx however when I go to that link, I am getting a 404 when I check it seems that I should go to https://{tenant}-admin.sharepoint.com/site/MySite/_layouts/15/appinv.aspx (sites to site) but then I get a 500 error. Though I am fairly new to SharePoint I really don't understand what I am missing, I have spent hours searching and I honestly have tried a whole bunch of things but having no luck.

Rookie
  • 115
  • 3
  • 12

1 Answers1

1

The admin site url is https://{tenant}-admin.sharepoint.com.

So you should go to https://{tenant}-admin.sharepoint.com/_layouts/15/appinv.aspx, without sites/mysite.

Michael Han
  • 3,475
  • 1
  • 6
  • 8
  • Thanks for the response, what I am trying to achieve is to give the app full access to the site, because I get the error: "Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown.". Used this to debug https://sharepoint.stackexchange.com/questions/214213/getting-data-from-sharepoint-online-with-an-app-service-to-service – Rookie Nov 15 '21 at 10:36
  • Have you enable app-only acess for your tenant? That is disabled by default. We could enable it by running powershell command ‘set-spotenant -DisableCustomAppAuthentication $false' . You should confirm with your tenant admin. – Michael Han Nov 16 '21 at 01:33