Hey Robert! I know this was a long time ago but I’m wondering if you had any breakthroughs or findings since this point?
I actually created my own community post here: Nextjs-auth0 async credentials and UserProvider that is, I think, very very similar to your ask / question.
I’m not SUPER concerned about the AWS details (I’m using a custom layer with Lambda + CDK to fetch secrets, they’re cached for 5 minutes at a time so), I’m just not really a Next.js expert OR an Auth0 expert so want to try to reduce extra calls to fetch these secrets if possible.
Realistically I don’t think there is a great solution, at least in my case because as long as I’m fetching these values at run time they just can’t be cached “forever”, so maybe this isn’t a huge deal, anything I set in memory within the Next / Auth0 application code will get destroyed when the function is shut down. Still, any improvements or learnings would be much appreciated!