SharePoint Online OAuth

Michael Tippett 1 Reputation point
2022-01-03T00:17:44.6+00:00

I am building a Software as a Service application, and I want my users to be able to authorise the webpage to upload files directly to their sharepoint document library.

I imagine the flow working like this:

User Logs into my Webpage
User clicks authorise SharePoint.
User set to SharePoint and logs in, SharePoint asks to confirm permissions.
Token returned and saved by webpage
Webpage then uploads files directly to document library
The problem I am having at the moment, is all the documentation I am seeing, only allows this flow if the user has registered an app in their SharePoint site using /_layouts/15/AppRegNew.aspx.

I will have many users, all with different sharepoint tenants, is there a authorization flow I can use for this situation?

I'm aware I could do this using flow and a custom trigger, but I'm trying to make it as simple for the end user as possible

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CaseyYang-MSFT 10,461 Reputation points
    2022-01-03T07:01:59.39+00:00

    Hi @Michael Tippett ,

    This article is an overview about Authorization Code flow steps: Authorization Code OAuth flow for SharePoint Add-ins.

    Following are the steps in the Authorization Code flow.
    1.Client opens an application and then directs it to a SharePoint site for data.

    2.The add-in redirects to the SharePoint site authorization URL.

    3.SharePoint displays the consent page so the user can grant the add-in permissions.

    4.SharePoint requests a short-lived authorization code from ACS.

    5.The SharePoint Online site redirects to the app's registered redirect URI, passing the authorization code to the add-in.

    6.The add-in uses the authorization code to request an access token from ACS, which validates the request, invalidates the authorization code, and then sends access and refresh tokens to the add-in.

    7.The add-in can now use the access token to request data from the SharePoint site, which it can display to the user.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.