CORS issue while access the sharepoint file via in microsoft grap api in web application

testuser 1 Reputation point
2022-07-04T07:22:43.503+00:00

Hi Team ,

Reg : Cors issue get the web application access O365 document

We have the web application to integrated with o365 document application,
For o365 document access happen via Microsoft graph API call in our application ,
While login a user via sso , we took the Access token then API call access to the SharePoint document .
While access the o365 document , we got the CORS issue in the server

Clarification :

we need to configure any other permission API [Delegate and Graph API] ?

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://login.microsoftonline.com/8887b081-7603-4489-8f21-3e1e10ac318e/oauth2/v2.0/authorize?state=b3db04cab16b4e04dbc24f6e08176703&scope=Files.Read%20Files.Read.All%20Files.Read.Selected%20People.Read%20Presence.Read%20Presence.Read.All%20profile%20User.Read%20User.Read.All%20ChatMessage.Send%20Chat.ReadWrite%20openid%20offline_access%20email&response_type=code&approval_prompt=auto&redirect_uri=https%3A%2F%2Ftvscloud.dev.betabasket.net%2Fo365%2Fcallback&client_id=4ccb587c-393e-409f-b96c-470b94a8f823. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

Microsoft 365 and Office SharePoint For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,251 Reputation points
    2022-07-05T08:44:35.937+00:00

    Hi @testuser ,

    Please check your permissions, according to my research and testing, if you want to access the SharePoint document, you need to have Sites.Read.All permission.

    217673-image.png

    More information for reference:
    https://learn.microsoft.com/en-us/graph/api/listitem-get?view=graph-rest-1.0&tabs=http#permissions

    Hope it can help you. Thanks for your understanding.


    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.