Forum Discussion
Rickard Nilsson
Feb 06, 2017Copper Contributor
Passing username to an external rest-service from SPFx WebPart
Quite often, we need to call external services from client side code. If it is a public API and you know your way around CORS, this is easy. But how do you implement a good authentication flow? L...
Luis Mañez
Feb 07, 2017MVP
Hi,
Is this sample not covering your scenario?
Call custom Web API secured with AAD from SharePoint Framework client-side web part
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-aad-webapi
Basically, you need to secure your custom web api using Azure AD, and then, from client side, you can use ADAL.js to get the Access token and call the API.
Let us know if it helps.
Is this sample not covering your scenario?
Call custom Web API secured with AAD from SharePoint Framework client-side web part
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-aad-webapi
Basically, you need to secure your custom web api using Azure AD, and then, from client side, you can use ADAL.js to get the Access token and call the API.
Let us know if it helps.
- Rickard NilssonFeb 07, 2017Copper Contributor
Hi,
I am sorry that I missed this one. I will try it out and document the result here.
Cheers,
Rickard
- Danny FonckeJul 26, 2017Copper Contributor
Any pointers to solve this when Azure is not in the picture ?
A user on a SharePoint 2013 on premise page calls an external REST api. How can the REST api authenticate the caller or verify that proof of identify is the resquest (token ?) is genuine ?Bon, I just realized I'm in an spfx thread :( So not the best place to put this question.
- Luis MañezJul 27, 2017MVPIt depends on How the external rest API authentication is configured, and also depends if the call inside an SP 2013 page is using server side code (custom webpart/page using Farm solutions), or just JavaScript.