Teams custom personal app (SPFx) - slow authentication startup in desktop app

%3CLINGO-SUB%20id%3D%22lingo-sub-1424186%22%20slang%3D%22en-US%22%3ETeams%20custom%20personal%20app%20(SPFx)%20-%20slow%20authentication%20startup%20in%20desktop%20app%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1424186%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe've%20implemented%20quite%20some%20Teams%20personal%20apps%20at%20clients%20now%20and%20the%20custom%20Teams%20apps%20in%20the%20(Teams%20desktop%20app)%20sometimes%20have%20load%20times%20ranging%20from%204s%20-%2010s%20before%20our%20custom%20code%20even%20begins.%20The%20Teams%20web%20app%20handles%20auth%20in%20a%20different%20way%2C%20so%20never%20any%20issue%20there.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20appears%20to%20have%20something%20to%20do%20with%20the%20way%20authentication%20is%20done%20in%20the%20desktop%20app%20(acquire%20OBO%20token%20call...).%20With%20a%20trick%2C%20you%20can%20also%20get%20the%20console%20%26amp%3B%20network%20tab%20to%20show%20in%20the%20desktop%20app.%20That%20way%20we%20can%20verify%20when%20our%20React%20is%20loaded%20%26amp%3B%20starting%20%2B%20when%20our%20backend%20api%20calls%20are%20done.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EClients%20are%20complaining%20about%20the%20response%20times%20and%20rightfully%20so.%20The%20response%20times%20before%20our%20code%20hits%20also%20varies%20greatly%20between%20tenants%20as%20mentioned.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHas%20anyone%20had%20the%20same%20experience%3F%20Is%20there%20a%20magic%20wonder%20solution%20out%20there%20that%20I%20don't%20know%20of%20yet%20(e.g.%20simple%20AAD%20authentication%20setting)%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1424186%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAuthentication%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESPFx%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1485755%22%20slang%3D%22en-US%22%3ERe%3A%20Teams%20custom%20personal%20app%20(SPFx)%20-%20slow%20authentication%20startup%20in%20desktop%20app%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1485755%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9922%22%20target%3D%22_blank%22%3E%40Pieter%20Heemeryck%3C%2FA%3E%26nbsp%3B%20We%20are%20experiencing%20the%20same%20problem%20%2C%20the%20api%20in%20azure%20takes%20like%20200%20ms%20.%20The%20time%20it%20takes%20the%20app%20to%20load%20is%20more%20than%205%20secs.%26nbsp%3B%20After%20checking%20loading%20time%20with%20developer%20tools%20you%20can%20see%20that%20authenticate%20method%20takes%20like%202-3%20secs.%26nbsp%3B%20%26nbsp%3BAny%20idea%20how%20it%20can%20be%20optimized%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369%22%20target%3D%22_blank%22%3E%40Vesa%20Juvonen%3C%2FA%3E%20%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20a%20bit%20sad%20that%20we%20spend%20a%20lot%20of%20time%20in%20make%20our%20systems%20as%20fast%20as%20possible%20and%20later%20SharePoint%20is%20making%20it%20slow.%26nbsp%3B%20The%20question%20is%20if%20this%20authentication%20is%20related%20with%20SharePoint%20or%20azure%20ad%20%2C%20if%26nbsp%3B%20we%20call%20an%20internal%20api%20from%20SharePoint%20will%20be%20faster%20or%20will%20be%20slow%20anyways.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi

 

We've implemented quite some Teams personal apps at clients now and the custom Teams apps in the (Teams desktop app) sometimes have load times ranging from 4s - 10s before our custom code even begins. The Teams web app handles auth in a different way, so never any issue there.

 

It appears to have something to do with the way authentication is done in the desktop app (acquire OBO token call...). With a trick, you can also get the console & network tab to show in the desktop app. That way we can verify when our React is loaded & starting + when our backend api calls are done.

 

Clients are complaining about the response times and rightfully so. The response times before our code hits also varies greatly between tenants as mentioned.

 

Has anyone had the same experience? Is there a magic wonder solution out there that I don't know of yet (e.g. simple AAD authentication setting) ?

1 Reply
Highlighted

@Pieter Heemeryck  We are experiencing the same problem , the api in azure takes like 200 ms . The time it takes the app to load is more than 5 secs.  After checking loading time with developer tools you can see that authenticate method takes like 2-3 secs.   Any idea how it can be optimized @Vesa Juvonen

 

It's a bit sad that we spend a lot of time in make our systems as fast as possible and later SharePoint is making it slow.  The question is if this authentication is related with SharePoint or azure ad , if  we call an internal api from SharePoint will be faster or will be slow anyways.