Forum Discussion
AuthenticationManager.GetAppOnlyAuthenticatedContext Azure App API permissions access denied
- Jul 10, 2019If you're connecting to the SharePoint APIs using the Azure App registration you'll need to do it with a certificate as detailed here https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread
Otherwise use the method in my other post
Please make sure you granted appropriate API permission to Azure AD app for SharePoint. You can do it by going to Azure AD and then 'App Registration' and then 'API Permissions'. Under Microsoft APIs, select SharePoint and then provide either delegated or application permission based on your requirement.
Rahul Suryawanshi The original poster had already done that, but was still getting an error. The problem is because a certificate needs to be created if you're accessing the SharePoint API using an Azure App registration (as detailed in the links I've provided in my replies). If you're using the GetAppOnlyAuthenticatedContext method you need to get the client id and secret through the SharePoint App registration method in AppRegNew.aspx
- ArvindKumar MepaniJul 19, 2019Brass Contributor
Toby Statham. Okay, Yeah, For the high trust, Sharepoint app requires certificate-based authentication. Thanks for pointing out to me.