Sharepoint WebPart with Graph API - azure-active-directory

Is there a way to use Sharepoint Framework Client side Webpart to use on classic Sharepoint Page ? I want to use Graph API. and it looks like i can use that using SpFx (without Azure AD App) but wondering if SpFx webpart can be added on classic SharePoint page (Project Online).
Also, I do not want to create Azure AD App to acquire access token and then use Graph APIs.
It looks like I have only following options:
Option 1: Use SpFx to create Webpart to use Graph API without registering App to Azure
Option 2: Use Azure AD App to access graph api access token and then use that token hit APIs
Is there anything else i can do ? 😁

SPFx web parts can be added to both classic and modern pages. See here: SPFx web parts can be added to both classic and modern pages.
And by using SharePoint Framework, you don't need to explicitly create Azure Active Directory applications to manage your permissions for your solutions.istead, you can request the needed permissions in your solution package, and Microsoft 365 tenant administrator can then grant the requested permissions in general for all solutions or for this specific solution (isolated solution). Read this article for more: https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis

Related

Office Add in Authentication Upgrade

I am new to Azure and Office Add in. I want to migrate one of my Office add in authentication mechanism. currently the authentication is implemented using Office-JS-helpers. I want to replace this library with any other alternative. Could anyone share the best way to migrate.
Application : Office Add in (Word and Outlook)
Add in is written using React 16+ version
App hosted on service fabric in azure
Authentication enabled using Azure AD
Note : I am Looking for SSO Authentication mechanism.
The Overview of authentication and authorization in Office Add-ins section in MSDN explains how to build and configure Office Add-ins to successfully implement authentication and authorization. You are interested in the following - Enable single sign-on (SSO) in an Office Add-in.

Do I need an Azure AD app to embed my Power BI reports in my own app?

I'm confused about the guideline I have to follow to embed some Power BI reports in a react app. I've been reading this documentation but I don't understand why I need an Azure AD app. By now I've created four Power BI reports and I've published them to the web (making them public and accessible for everyone). So, I've got four PBI links to access them. But I want to create a web app (probably with React) to embed them all in one link.
I understand that Azure covers authentication features, but my app will only show information, doesn't need users to log in or something. So, I guess Azure helps to authenticate to the PBI account I'm using. But if this is the case, why PBI doesn't ask me for authentication when I share the reports links with anyone?
Thank you in advance!
You need Azure AD app to have identity for your application, to authenticate to Azure AD (using MSAL for example) and for using the Power BI REST APIs. Check the following article: https://learn.microsoft.com/en-us/power-bi/developer/embedded/register-app
Since you are already logged in you don't need to login to PowerBi again, There are two ways to embed your PowerBI reports,
Publish to web -> Does not require authentication (Public reports)
Embed with authentication -> Hyperlink and token based ( Requires Azure AD)
You can check more information here

Implement SSO in windows application/vsto plugins

I have a requirement to implement SSO for desktop applications created using WPF and office plugins developed using VSTO. I have some basic knowledge about SSO that how it works for websites (based on redirection).
I did some research and found that there is no way we can access the WebBrowser control in WPF to get the access token. I need to use the access token to call the rest services created in java and hosted on some URL.
Is there any way to get access token using windows applications.
Also, as per my understanding only Web-Addins support SSO with Azure AD v2.0. Can you guide me to some good links to achieve it? Please let me know if my question makes sense or some additional information is required.
*All clients do not use Azure AD solution.

Office Add-In SSO with an AAD v1 app registration

I am developing a office add-in.
This office Add-In is supposed to retrieve the term store from SharePoint.
By following this tutorial:
https://learn.microsoft.com/en-us/office/dev/add-ins/develop/create-sso-office-add-ins-aspnet
I managed to get an access token to be used for Graph api. However the Graph does not expose any way of getting the term store. Is there a way we can generate an access token to be used with SharePoint and maintain the SSO?
It might be possible by registering an Azure AD v1 app but I could not find any documentation describing that.
I have a similar requirement, but in my research I wasn't able to find a good solution for this scenario.
I think it is probably possible to use a provider hosted SharePoint add-in. And then use the Authorization Code flow for obtaining an access token. Since the SharePoint add-in is trusted it will not require user login.
Of course this does mean the add-in needs to be deployed in SharePoint. If your Office add-in is distributed through the store this isn't really a great solution.
Hopefully there are other ways of achieving the same.
You could call SharePoint Online APIs (via REST or CSOM) with Azure Active Directory Apps. To call APIs secured by Azure AD, your app must acquire an access token from Azure Active Directory.
Please first refer to this document for integrating applications with Azure Active Directory. Then use Azure Active Directory Authentication Library (ADAL) to easily authenticate users to cloud or on-premises Active Directory (AD), and obtain access tokens for securing API calls.

Accessing Office Graph apis with Sharepoint Online login?

We've been running an Angular app in a custom masterpage during the last year, using the Sharepoint REST api to retrieve user properties, data from lists etc., which has been working fine. As the application is hosted on Sharepoint Online, accessing the page requires a login thus making the request digest available so further authentication is not necessary.
Now however, we want to start using some of the functionality in the Microsoft Graph API. From what I can gather this requires OAuth2 authentication against the Azure Active Directory, involving among other things a redirect to the AAD login page.
Does this mean I have to:
1) Login via the organizations (standard Microsoft) login page to access the Sharepoint Online site.
2) Redirect to the Azure AD login page and back again?
Or can I leverage the login that the user already did when logging into Sharepoint Online?
Sorry if the question is a bit vague, we are all still very new to this.
When registering your application on Azure AD you will give the app access to Files/Sharepoint REST api and Microsoft Graph API. See this picture the app has access to several apis (Exchange, Graph and AD) you must add sharepoint APIs in your case.
Regarding the authentication, I am afraid that the Sharepoint model does not provide a token that will enable you to request the Graph API see this. You will have two authentications, one to access the Sharepoint site, as you said, and the other "within" the sharepoint iframed add-in to log into your AAD's registered app. This will be an OAUTH process through login.microsoft.com. Have a look at my Outlook add-in Keluro Mail Team on the Office store, I think it is similar to what you want to achieve.
You can use the same token from graph.microsoft.com. I have a sample using Asp.Net Core 1.0 and the.Net ADAL but the same authentication flow is used when using ASP.NET 4.6. Just make your auth request against ms graph on startup then acquire access token to auth against SharePoint.
https://github.com/edrohler/com.ericrohler
Hope this helps.

Resources