Your tenant administrator has to approve this app. App-Only CSOM

developer sp1 461 Reputation points
2021-03-08T05:57:37.563+00:00

I'm using App Only permission in CSOM and set the permission like this in AppInv.aspx:

75264-snipaste-2021-03-08-13-55-28.png

However, it give me the capture below:

75233-snipaste-2021-03-08-13-52-38.png

I'm already the Tenant administrator and I really can't use real user credential in my CSOM code, please anyone can help me on this ?

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,576 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points
    2021-03-09T02:11:05.657+00:00

    Hi @developer sp1 ,

    Redirect to the SharePoint Online Admin Center appinv.aspx using this url:

    https://TenantName-admin.sharepoint.com/_layouts/15/appinv.aspx

    75569-1.png

    75651-sharepointapponly3.png

    Thanks
    Best Regards


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Joey O 26 Reputation points
    2022-10-25T21:38:35.61+00:00

    I stumbled on this same problem tonight and then realized the mistake I had made, which I believe is the same as the OP.

    The two step process has two unique URLs. The first:

    https://contoso.sharepoint.com/_layouts/15/appregnew.aspx

    is different than the one used for enabling the trust of the app

    https://contoso-admin.sharepoint.com/_layouts/15/appinv.aspx

    take specific note of the addition of the "-admin" after the tenant name in the second URL. Hopefully this clears it up for future readers.

    5 people found this answer helpful.