---
title: "Sharepoint Online 365 OAuth Setup"
slug: "sharepoint-online-365-oauth-setup"
updated: 2025-05-01T12:36:38Z
published: 2025-05-01T12:36:38Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sharepoint Online 365 OAuth Setup

## 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.

Prerequisites

- [Sharepoint Module](/v9/docs/sharepoint-module-basics-lists) 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.

1. Open the [Azure Portal](https://portal.azure.com/ )
2. Navigate to App Registration and create a new web application
3. Copy the Application (client) ID and Directory (tenant) ID from the app's Overview page.
4. Register as an Enterprise Application
5. Navigate to AzureAD App - Authentication
6. [Set the Scope](https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread) for the application

### Retrieving Client Secret

1. Open the [Azure Portal](https://portal.azure.com/ )
2. Navigate to Microsoft Entra ID
3. Navigate to App registrations
4. Select the desired Application
5. Navigate to Certificates & Secrets
6. 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)

Classic SharePoint Add-Ins SupportClassic SharePoint Add-Ins are supported in Sharepoint Online until April 2, 2026, after which they will be retired. New Add-Ins cannot be submitted or installed. For modern development, use Sharepoint Framework (SPFx) and Azure AD apps. On-premises SharePoint still supports Add-Ins.

| 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.
