Fast user auth for embed

Chris Merrick, Elliot Park · Friday Demos · January 24, 2025 · 6:43

We put a bunch of work into a new path for embed to massively speed up user authentication, even with lots of attributes, plus some conversation about the future.

Try it yourselfThe full week on docsadministrationembedperformance

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. I got a super quick one um as everybody knows I've been deep in the uh performance optimization mines recently um one of the things that I uh have noticed is that embed iframes take a long time to just initialize um and taking a quick peek at the code I realized that um a lot of that time is actually being spent generating the session token um and so if I sh my scen screen where are you sorry we um so the session token actually doesn't need to be recreated every time um it's good for 24 hours believe uh so just to kind of give you an example uh we just I just put in a very simple optimization to just not recreate the session token if

  2. it already exists um and is valid I actually just added a hour buffer so it'll recreate it just so nobody gets logged out um so uh when you first load the frame it's still kind of slow um but now if you go you basically any navigation or kind of reload of the frame within that uh session lifetime is substantially faster so you know this went from about a second to about 230 milliseconds um so shaved it down it's about 25% of the of the time uh because this the other sort of interesting takeway here is uh the generating the session tokens should not have to take that long so uh it opens up a very obvious Next Step here which is to change the way

  3. we are generating session tokens to make the much faster it's a bit of a bigger lift but uh I'm going to go dive into that now because it just shouldn't need to this way um does this mean that we would have people load up the iframe silently in another page in their app so that when they navigate to the page it's just sitting there or like what on initializing it yeah we're already having people do that I I think we can continue having them do that um or I also think this may make that less necessary because you know that second load should be a lot snappier um so I think you know I think I was literally on a thread with Nate in Elliott

  4. in the past day or two about that specifically and you know we've already said that's fine um and we do it in gleam I believe um but it also yeah hopefully like knock on wood we shouldn't need people to have to think about that kind of optimization all if if we are sorry goe yeah I don't want to put o down the spot but if you're here do you want to describe the two-step login that we're also going to add idea behind the twostep logging is that rather than forcing you to um off in and all to off in and then perform all the crud work kind of associated with an SSO embed login which includes things like user creation user attribute Association group Association

  5. and so on um the two-step login will um actually handle all the crud work um in a first step endpoint which is actually just going to be a part of our API um so it'll just kind of come with our standard Suite of API endpoints and uh we'll generate an embed session we'll create a user for you we'll um do all the sort of stuff that is the he you know the heavy lifting sort of work associated with an SSO embed login and then from there uh once that sess session is generated it's valed for five minutes uh to be used and um you'll hit a second end point or not necessarily second end point but you'll make a get request to a separate URL

  6. uh using that session token that's returned from the uh first endpoint and if it's used within five minutes you'll go and off in as that s embed user and um you know theoretically the flow would be that uh an embed developer would you know generate a session for their user behind the scenes maybe like when they log in uh to whatever parent page is hosting us or embedding us and then from there uh the actual like loading of Theo content would feel super fast because all the sort of heavy lifting has already been taken care of so yeah that's yeah and just to to add one thing to that or a couple pieces of detail that sort of dovetail with what Chris has been looking

  7. at uh we likely expand that five minute limit to be longer so you could imagine as an admin you let's say you have a thousand bad users you could schedule a script to onun at night that generates a a token for all of your 10,000 Ed users and stores each token in in your own database and then when they wake up in the morning and go to log in the work is just finding that token and then authorizing the session through us with the token so all that slow expensive cred work just gets uh pushed into sort of like an async out of band process um and then the other detail is we're looking as a nice way to to allow us to redeem the

  8. same token multiple times um so that just prevents us from having to do the token creation user creation dance uh whenever you know like a different tab is open and that has a different embed if frame um so all these things should make that initial experience quite a bit snappier if we are like decou those steps of the authentication versus the content in the URL would that potentially open the door to being able to have like deep link like deep links to if I want to share someone a URL that brings them to a specific SSO URL content so like I'm I'm somewhere I've I've navigated within the if frame I grab a URL and I can come back to that URL later without having

  9. to like start from the same place yeah I mean that that's what I just Ed so that you would use what I demoed so orth thogal to the twostep login but they would all work together okay cool Sorry Miss something