App-Only is a model for setting up app principals. It can be used with SharePoint Online, as will SharePoint on-premises (SharePoint 2013 and above versions).
- Navigate to SharePoint site (e.g., https://tenant.sharepoint.com)
- Open appregnew.aspx page (https://tenant.sharepoint.com/_layouts/15/appregnew.aspx).
- Click “Generate” button against Client Id row to generate a new client id.
- Click “Generate” button against Client secret row to generate a new client secret.
- Type any Title, which describes your app principal.
- Type App domain as www.localhost.com
- Specify redirect URI as https://www.localhost.com.
- Click Create.
- Note down the Client Id and Client Secret for future references.
Grant’s tenant scoped permissions to the newly created principal.
- Open SharePoint Tenant site with Tenant Administrator account (https://tenantname.sharepoint.com/_layouts/15/appinv.aspx, https://tenantname-admin.sharepoint.com/_layouts/15/appinv.aspx)
Online – https://m365x634254.sharepoint.com/_layouts/15/appinv.aspx
On Premises – http://klstsp16:2016/_layouts/15/ appinv.aspx
- In the App Id textbox type your generated Client Id
- Click the Lookup button
- In the Permission Request XML textbox type below xml,
<AppPermissionRequest Scope=”http://sharepoint/content/tenant” Right=”FullControl”/> </AppPermissionRequests>
- Click Create button
- In the next dialog click Trust It button.
OneDrive Client ID and Secret Id Generation
Step 1: Please open the azure portal in browser https://portal.azure.com/#home
Step 2: Please click the “Azure Active Directory
Step 3: Once Azure Active Directory open after click the “App Registrations”
Step 4: Then Click the “New registration”
Step 5: New App register page open, now register the App.
Step 6: Once register after our app page is open, now click the “API Permissions”
Step 7: Now provide the permission for API’s , please refer the below screen shot.
Step 8: Now click the “Certificates and Secrets” and generate the Client Secret Id
Step 9: Finally Click the “Overview”, once page open after you get the client ID and Tenant Id
Step 10: Now you get Client Id and Secret Id and Tenant Id, This Id’s used create the OneDrive sync job in Sync APP