- 01 May 2025
- 1 Minute to read
- Print
- DarkLight
Sharepoint Online 365 OAuth Setup
- Updated on 01 May 2025
- 1 Minute to read
- Print
- DarkLight
Overview
The following document will cover the steps required to set up and integrate with Sharepoint Online 365 using OAuth. Currently, there are two valid methods to generate OAuth tokens needed to establish a connection, using the Add-In Method, and only using Sharepoint Azure AD App method.
- Sharepoint Module installed
- AzureAD configured
AzureAD App Creation
To fully integrate with Sharepoint, an application in AzureAD will need to be created. This will also be used to retrieve the client secret and client ID.
- Open the Azure Portal
- Navigate to App Registration and create a new web application
- Copy the Application (client) ID and Directory (tenant) ID from the app's Overview page.
- Register as an Enterprise Application
- Navigate to AzureAD App - Authentication
- Set the Scope for the application
Retrieving Client Secret
- Open the Azure Portal
- Navigate to Microsoft Entra ID
- Navigate to App registrations
- Select the desired Application
- Navigate to Certificates & Secrets
- Copy the Secret "Value"
Generating OAuth Tokens
Using Add-In Method
This method uses OAuth 2.0 to obtain an access token for a server-side component of the add-in to interact with a remote service.
Oauth Provider Endpoints
Endpoint | Example Value |
---|---|
Token Request URL | https://login.microsoftonline.com/{tenant ID}/oauth2/v2.0/token |
Token Refresh URL | Optional |
Authorize URL | https://login.microsoftonline.com/{tenant ID}/oauth2/v2.0/authorize |
Callback URL | v7/v8/v9: "https://[BasePortalURL]/HandleTokenResponse” v7/v8/v9: "https://[BasePortalURL]:[PortNumberIfIInstalledOnAltPort] /HandleTokenResponse” v6: "https://[BasePortalURL]/HandleTokenResponse.aspx” |
Default Consumer Key | Azure App Client ID |
Default Consumer Key Secret | Azure App Client Secret VALUE |
Oauth Provider Endpoints (Classic Sharepoint)
Endpoint | Example Value |
---|---|
Token Request URL | https://accounts.accesscontrol.windows.net/[Tenant ID]/tokens/OAuth/2 |
Token Refresh URL | Optional |
Authorize URL | https://[Tenant Name].sharepoint.com/_layouts/OAuthAuthorize.aspx |
Callback URL | https://[BasePortalURL]/HandleTokenResponse https://[BasePortalURL]:[PortNumberIfIInstalledOnAltPort]/HandleTokenResponse |
Consumer Key | The default consumer key will be [Sharepoint Add In ClientID]@[TenantID] |
Using Sharepoint Azure AD App Only
Endpoint | Example Value |
---|---|
Token Request URL | https://login.microsoftonline.com/{tenant ID}/oauth2/v2.0/token |
Token Refresh URL | Optional |
Authorize URL | https://login.microsoftonline.com/{tenant ID}/oauth2/v2.0/authorize |
Callback URL | v7/v8/v9: "https://[BasePortalURL]/HandleTokenResponse” v7/v8/v9: "https://[BasePortalURL]:[PortNumberIfIInstalledOnAltPort] /HandleTokenResponse” v6: "https://[BasePortalURL]/HandleTokenResponse.aspx” |
Default Consumer Key | Azure App Client ID |
Default Consumer Key Secrect | Azure App Client Secret VALUE |
OAuth Provider Endpoints (Classic Sharepoint)
Endpoint | Example Endpoint |
---|---|
Token Request URL | https://accounts.accesscontrol.windows.net/[Tenant ID]/tokens/OAuth/2 |
Token Refresh URL | Optional |
Authorize URL | https://[Tenant Name].sharepoint.com/_layouts/OAuthAuthorize.aspx |
Callback URL | https://[BasePortalURL]/HandleTokenResponse https://[BasePortalURL]:[PortNumberIfIInstalledOnAltPort]/HandleTokenResponse |
The Default Consumer Key will be 00000003-0000-0ff1-ce00-000000000000/[TenantName].sharepoint.com@[TenantID]
Sharepoint Limitations
Sharepoint has inherent limitations in its capacity to handle files. They are:
- Only 5,000 files can be displayed in a view.
- Only 300,000 files can be in a library before there are performance issues.
- Unique document permissions are limited to 50,000 items per list.