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...
Butch Marshall
Apr 10, 2018Copper Contributor
Any update on this? I am also looking to implement using Sharepoint authentication against an external API without having any input from the user.
The closes I've found is using HttpClient to pass credentials as described https://dev.office.com/blogs/calling-external-apis-securely-from-sharepoint-framework. I've hit a blocker unfortunately. The Authorisation header is there - but its empty!
Luis Mañez
Apr 17, 2018MVP
Recently the SharePoint spfx team has released a new Azure AD Http Client that helps to call Azure AD Secured APIs from spfx. Have a look here:
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad
https://www.youtube.com/watch?v=_9fGXZ4ocp4&index=3&t=0s&list=PLR9nK3mnD-OUnJytlXlO84fQnYt50iTmS
Luis.
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad
https://www.youtube.com/watch?v=_9fGXZ4ocp4&index=3&t=0s&list=PLR9nK3mnD-OUnJytlXlO84fQnYt50iTmS
Luis.