Forum Discussion
Passing username to an external rest-service from SPFx WebPart
Please, keep us posted if you find a solution, as is a very interesting scenario.
Good luck!
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 in this tutorial. I've hit a blocker unfortunately. The Authorisation header is there - but its empty!
- valentinbApr 16, 2019Copper Contributor
May be someone could help me there : https://social.msdn.microsoft.com/Forums/en-US/a5bb4435-ff29-447a-b5dc-86d3d75c7ca4/best-way-to-connect-external-api-with-a-webpart-for-sharepoint-online?forum=architecturegeneral#a5bb4435-ff29-447a-b5dc-86d3d75c7ca4
- Butch MarshallApr 01, 2019Copper Contributor
Danny Foncke Yep!
I use a Microsoft Graph JWT.
I verify the JWT is genuine using the keys microsoft publishes and thus can trust that is the logged in user.
- Danny FonckeMar 31, 2019Copper Contributor
Hi butch, have you ever found an answer to the question (user already logged in to SharePoint.....) ?
- Luis MaƱezApr 17, 2018MVPRecently 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.