Forum Discussion

Muhammad Farhan's avatar
Muhammad Farhan
Copper Contributor
Mar 11, 2019

Accessing Graph API from SharePoint JavaScript without additional authentication

I am using JavaScript for getting Calendar events for a user from Microsoft Graph API. I am using OAuth v2 for authentication.

However, my customer says this is not necessary because the user is already logged into SharePoint online, therefore there is no need to log in again as there must be a way to get the access token without having to log in again.

Is there a way to get the access_token for the Microsoft Graph API from inside a SharePoint online page without prompting the user and without opening that Microsoft account login window?

1 Reply

  • Kevin_Morgan's avatar
    Kevin_Morgan
    Iron Contributor

    Have you checked the below posts?

    https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-msgraph
    https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/call-microsoft-graph-from-your-web-part

Resources