1-click auto login of demo user

I’d like to showcase my app in a live demo mode : it’s a dedicated read-only user with fake populated data so prospective users can look around and get a feeling of how the features work.

My front end is React and communicates with a backend API w/JWT.

Regular authentication works great.

Ideally I’d have a button labeled “live demo” in the login page that gets you to the app in 1 click (instead of typing “demo”/“demo”) logged in as this hardcoded user ?

Hi @dan.dimerman,

I think you could achieve this a few different ways.

You could bypass the login completely, and have a hard coded token that is returned when they click a demo button.

You could also have them sign up for the app (this way you get an email for marketing), and select a demo checkbox or additional input field, then populate the demo data on that account in a rule.

You could set up a resource owner password grant, and get a token for a demo user by sending a demo username/password directly to the auth API (this would get around a login page). Be careful, this grant type opens up your app to some security concerns. I would not recommend this as a first choice.

Or give them a username/pw for a demo user.

This will end up depending on how you want to engineer it.

Hi @dan.woda and thanks for your reply.
I like the first option, but I could use some help with the technical details.
I’m using the useAuth0() hook in several points in my code that gives me the isAuthenticated value.
Is there a way to set these hard-coded values in the context, so I don’t have to wrap the hook on every place I use it at the moment?


Apologies, I could have better clarified what I was suggesting there. There isn’t a way to pass a false value into the react SDK. You will have to bypass it in your demo version, and pass some fake demo data.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.