Introducing Protected Pages
Learn how LaunchFa.st helps you create protected pages to prevent un-authenticated access.
LaunchFa.st comes with baked-in protected page(s) to help you prevent un-authenticated access to such pages. With the authentication methods such as Twitter OAuth 2.0, Google OAuth 2.0 and Credentials (email and password) built in with LaunchFa.st, such authenticated methods can be used by your users to get access to the protected pages in your application.
Here’s how easily you can create protected pages with LaunchFa.st:
- Create a file, say
protected.astrowith the following code:
---import { getSession } from '@/lib/utils/auth'
const session = getSession(Astro.cookies)
if (!session) return webResponse('Unauthorized', 403, {})---
<html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> </head> <body class="font-display"> <div class="relative mx-auto flex max-w-7xl flex-col px-8 sm:px-4 py-8"> <h1 class="pb-6 text-3xl font-medium text-launchfast">Protected Content!</h1> </div> </body></html>- That’s it! The
getSessionin the LaunchFast Starter Kit takes care of decoding the session cookies and validating the user authentication status. If unauthorized, a 403 response is sent enforcing authentication based access to the content.
Worry not, with LaunchFa.st you get such a page protected.astro built for you with goodies on top.
Starter guides for this feature
Pick your framework. Each guide walks through one provider end to end.
- google oauthNext.jsAstroSvelteKit
- github oauthNext.jsAstroSvelteKit
- email passwordNext.jsAstroSvelteKit
Continue reading
Waffo Pancake Payments Now Available in LaunchFast Starter Kits
We're excited to announce that Waffo Pancake payments are now available in all LaunchFast starter kits. Accept one-time and subscription payments through a merchant of record with a few environment variables.
Creem Payments in LaunchFast Starter Kits: Merchant of Record Checkout for SaaS
Every LaunchFast starter kit ships with a Creem checkout and a verified webhook route. Sell one-time products and subscriptions through a merchant of record that handles sales tax and compliance.
Polar Payments in LaunchFast Starter Kits: A Merchant of Record with No Extra Dependencies
Every LaunchFast starter kit ships with a Polar checkout and a verified webhook route. Sell one-time products and subscriptions through a merchant of record that handles sales tax for you.