This would be really helpful. I think the tutorials around implementing auth0 to protect certain pages are well written, I adapted this tutorial for my own application.
What is a bit trickier to implement, and what I am struggling with currently, is a “paywall” as @donovan describes.
Ideally a blog post/tutorial would assume you have already successfully implemented authentication using auth0. Selfishly, I would like that to be in React as a natural follow on to the article linked above. The closest tutorial I have found to being helpful so far is this
I think a useful structure would be;
- Authenticated user clicks Buy Button (unauthenticated user asked to SignUp)
- Stripe Modal/PopUp/Redirect
- User purchases
- Stripe webhook updates Auth0 profile with “paid: yes” (or similar)
- “Paid up” Authenticated User is redirected back to Application
- “Paid Up” user can now access premium content
- Reversion to “normal” membership if user unsubscribes/doesnt pay
The above logic might be quite accurate- I am not sure how stripe and auth0 best communicate.
Also useful, rather than having 3 “tiers” (causual visitor, member, paid subscriber), inclusion of stripe/paypal in the user onboarding process would be useful in alot of cases whereby you are either a casual visitor or a paid subscriber.
IndieHackers have a lot of discussion around Auth0 and how it integrates with stripe if you wanted to do some extra research on use cases.