ADAL Rest API SharePoint Online

Copper Contributor

Hi Guys,

 

Is it possible to secure access to the SharePoint Rest APIs using ADAL? getting confused messages from blog posts

 

I have created an "Application Registration" in Azure Active Directory and and I can authenticate using its secret to get a token. However when I pass the token as part of my SharePoint rest call I get a 401 error.

 

I have done something similar using Dynamics and ADAL and I had to assign rights to the registered application within Dynamics. I did not do this in SharePoint however I did give it Application Rights in the Azure portal

 

Thanks

Joe

 

 

6 Replies

Hi @Joe Gill,

 

Can you tell us what SharePoint resource you are trying to access to (i.e what is your REST call) and what permissions you've set for your AAD app? It can be simply a normal behavior due to insufficient permissions.

Maybe this webcast could give you also some more insights on securely accessing APIs using the SharePoint FrameWork (SPFx).

 

https://dev.office.com/blogs/calling-enterprise-applications-securely-from-sharepoint-framework 

Hi Franck,

 

I gave the application rights as follows in Azure AD. Just trying to go a GET to read items

 

Is it possible to use ADAL for server to server authentication to SharePoibt online?

 

Thanks

Joe

 

sahrepoint.png

Yes it is possible to use ADAL for server-to-server authentication using app-only access. However, you will need a certificate to get it work with Azure AD. More info here here.

 

This is why you get a 401 status because you don't have one.

 

Franck.

 

 

 

@Joe Gill Do you still have issues with this? Did you try the certificate approach?

 

Thanks!

Hi Franck

 

Not had a chance yet. Thinking of using the SharePoint CSOM and wrap this in an API which we can call

 

thanks for you help

Cheers

Joe